jsPsych v5.0 release

142 views
Skip to first unread message

Josh de Leeuw

unread,
Jan 7, 2016, 5:13:50 PM1/7/16
to jsPsych
Version 5.0 is here! Check out the release page on GitHub for more information: https://github.com/jodeleeuw/jsPsych/releases/tag/v5.0.

This is a major change, with a completely new backend and simplified syntax for building experiments. It should be much easier for brand new users to get started.

I've tested as much as I can, but I haven't gotten around to create automatic tests yet so there could be lurking bugs. Please let me know if you find any!

Adrian Oesch

unread,
Jan 8, 2016, 5:47:39 AM1/8/16
to jsPsych
great!

one small note on safari and fullscreen. to my knowledge safari doesn't support keyboard input in html input fields, but the keyboard events in javascript are still triggered. at least that's my experience with this experiment in safari: http://php-coglab.rhcloud.com/experiments/wordlist-matrix.html


Josh de Leeuw

unread,
Jan 8, 2016, 8:41:35 AM1/8/16
to Adrian Oesch, jsPsych
Interesting... when I tested fullscreen mode I couldn't get keyboard events to register in Safari. I'll investigate further. Thanks for the pointer!

On Fri, Jan 8, 2016 at 5:47 AM Adrian Oesch <helloadr...@gmail.com> wrote:
great!

one small note on safari and fullscreen. to my knowledge safari doesn't support keyboard input in html input fields, but the keyboard events in javascript are still triggered. at least that's my experience with this experiment in safari: http://php-coglab.rhcloud.com/experiments/wordlist-matrix.html


--
You received this message because you are subscribed to the Google Groups "jsPsych" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jspsych+u...@googlegroups.com.
To post to this group, send email to jsp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jspsych/4cb30eda-f984-4052-bb88-64d5430df7e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Adrian Oesch

unread,
Jan 13, 2016, 11:20:14 AM1/13/16
to jsPsych
hi again,

an issue came up: at what point are single blocks transformed into multiple trials? in earlier versions one could submit an array as parameter to the create trials function. where one block was transformed into multiple trials. is this not possible anymore? i couldn't get it to work in a plugin i wrote. 

thanks anyway ;) 

Josh de Leeuw

unread,
Jan 13, 2016, 11:25:24 AM1/13/16
to Adrian Oesch, jsPsych
Right, this is no longer possible. I think one of the major stumbling blocks for new users of the library was figuring out what parameters needed to be in arrays, how deep the array structure had to be, and how it all related to trials. Now the objects on the timeline get passed directly to the plugin.trial method, which makes the relationship much easier to understand. The shortcut that you can use now is slightly less of a shortcut, but it's not too bad. You can nest trials, and nested trials take on all the properties of their parent:

Version 4.x:

var trials = {
  type: 'single-stim',
  stimuli: ['img1.jpg', 'img2.jpg', 'img3.jpg'],
  choices: ['y','n'],
  timing_response: 2000
}

Version 5.0:

var trials = {
  type: 'single-stim',
  choices: ['y','n'],
  timing_response: 2000,
  timeline: [
    {stimulus: 'img1.jpg'},
    {stimulus: 'img2.jpg'},
    {stimulus: 'img3.jpg'}
  ]
}


--
You received this message because you are subscribed to the Google Groups "jsPsych" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jspsych+u...@googlegroups.com.
To post to this group, send email to jsp...@googlegroups.com.

Ian Eisenberg

unread,
Jan 13, 2016, 4:59:31 PM1/13/16
to jsPsych, helloadr...@gmail.com
I have a question about creating plugins in 5.0. I noticed that plugins no longer explicitly define trial.stimulus though they have others like trial.choices. What determines which parameters explicitly have to be specified in the plugin?

Similarly, other plugins like "jspsych-categorize.js" no longer have certain expected parameters like "key_answer".

I'd like to get some basic clarification about the specification of parameters so I can refactor some old plugins I've made.

Thanks!
Ian

Josh de Leeuw

unread,
Jan 13, 2016, 9:58:29 PM1/13/16
to Ian Eisenberg, jsPsych, helloadr...@gmail.com
The key change is that **all** of the parameters in a timeline object get passed in as the trial parameter. So even though the categorize plugin still requires that you pass in key_answer, it doesn't get referenced until line 82 (https://github.com/jodeleeuw/jsPsych/blob/master/plugins/jspsych-categorize.js#L82) because there is no default value that gets set at the start of the trial.

If you set the 'type' parameter of the trial on the timeline to a valid (loaded) plugin and there is no 'timeline' parameter, then all the other parameters will get passed into the plugin.trial method as the trial parameter.

Ian Eisenberg

unread,
Jan 15, 2016, 3:29:43 AM1/15/16
to jsPsych, ianeise...@gmail.com, helloadr...@gmail.com
That makes sense. I see you got rid of "enforce_array". I thought that was useful to alert people that there were a few variables that had no default values that they must enter (like stimulus). That has been removed?

Josh de Leeuw

unread,
Jan 15, 2016, 8:59:06 AM1/15/16
to Ian Eisenberg, jsPsych, helloadr...@gmail.com
Yes, that's been removed because there is no longer a situation in which you might put a single value in, but need to convert it to an array for the sake of converting the block into a set of trials. For example, in version 4.x, this was valid:

var trial = {
  type: 'single-stim',
  stimuli: 'imgA.jpg'
}

But really the enforce array parameter changed the value of stimuli to ['imgA.jpg'].

In version 5.0, there's never a situation in which this is needed because each object only defines one trial.

However, I think alerting users that there are values missing with an error message is a good idea for a future version. I could imagine each plugin registering which parameters are required when the plugin file is loaded, and the experiment can be checked for consistency before starting. I'll add this to the GH Issue tracker.

--Josh

Reply all
Reply to author
Forward
0 new messages