question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Retrieving all timeline variables for a given trial

See original GitHub issue

I currently have a design that uses a lot of timeline variables, and one annoying aspect is that I sometimes forget adding one of the timeline variables to the data section (I’m actually not sure why they are not automatically put into the data, as otherwise that information is just lost).

So some data section looks like this:

data: {
    segment: "word-classification",
    audiofile: jsPsych.timelineVariable('audiofile'),
    word: jsPsych.timelineVariable('word'),
    trial: jsPsych.timelineVariable('trial'),
    repetition: jsPsych.timelineVariable('repetition'),
    group: jsPsych.timelineVariable('group'),
    choices: jsPsych.timelineVariable('choices'),
}

This is because I couldn’t find a way to just retrieve all timeline variables, in which case I could just do something like:

data: jsPsych.allTimelineVariables()

Is it only possible to ask for one specific variable name and get back whether it exists or not, or is there not an actual list accessible somewhere?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jkrumbiegelcommented, Mar 10, 2021

Thanks for fixing this!

0reactions
jodeleeuwcommented, Dec 28, 2020

I implemented a first pass at this in the features-all-timeline-vars branch. I added a single test case to the end of timeline-variables.test.js. It needs a lot of expansion to make sure this implementation works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating an Experiment: The Timeline - jsPsych
One is that it allows you to define common parameters across trials once and have them apply to all the trials on the...
Read more >
2. Randomisation, repetition and variables - jaysire
Avoid code duplication using timeline variables; Randomise the order of trials within a block; Repetition of blocks of trials.
Read more >
Making prompt in between a trial sequence, loading different ...
The most brute force way I can imagine is to just initialize that amount of variables and push all of them to the...
Read more >
3.1 Timeline Variables | Online Behavioral Experiments with ...
The timeline_variables parameter is an array that contains one or more objects, where each object contains the information that is specific to a...
Read more >
The structure of a jsPsych experiment
var trials_with_variables = { timeline: [trial], timeline_variables: variables };. Then change jsPsych.run to run this: jsPsych.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found