0

I have to modify an existing jsPsych experiment to summarize reaction times over conditions.

I thought I could start by writing a simple function called within jsPsych.init() that I named extractingData(). I get this message in my console: "Uncaught TypeError: jsPsych.data.get is not a function"

Here is the line:

var myData = jsPsych.data.get().filter({trial_type: 'poldrack-single-stim'}).filterCustom(function(x){return x.trial_num > 0});

In the jsPsych official documentation they provided this example:

var data = jsPsych.data.get().filter({trial_type: 'image-keyboard-response'}).filterCustom(function(x){ return x.rt > 100; });

Any help would be greatly appreciated. Thanks in advance.

  • What version of jsPsych are you using? `jsPsych.data.get()` was added in version 6.0. – Josh Jun 15 '21 at 15:47
  • I've been unable to find which version was used in the original test: https://github.com/expfactory-experiments/attention-network-task Substituing jsPsych.js version 6.3 issues even more errors elsewhere. The first of which is "The display_element specified in jsPsych.init() does not exist in the DOM." (In jsPsych.js at line 144). A user suggested me to remove the parameter of `display_element` in my jspsych.init() `display_element: "getDisplayElement"` as it appears that it is not of the 'undefined' type. – Thibault C. Jun 17 '21 at 13:26
  • One issue that suppressed the error message was to remove the line 177 in jspsych.js : `opts = Object.assign({}, defaults, options);` so that default settings are always kept. Doing so, another error popped out line 904: "Trial level node is missing the "type" parameter. The parameters for the node are: {}", and a number of "Uncaught TypeError: Cannot read property ... of undefined" are issued. – Thibault C. Jun 17 '21 at 13:41
  • Still trying to understand, bear with me. A better way is to state ```display_element: undefined``` in jspsych.init(). Doing so, I get this error: "Uncaught TypeError: Cannot read property 'parameters' of undefined" in jspsych.js at line 1082 (evaluateFunctionParameters). – Thibault C. Jun 17 '21 at 14:14
  • In the initial version, there is ```module.evaluateFunctionParameters = function(trial, protect) {}``` and in 6.3.0 it was changed to ```function evaluateFunctionParameters(trial){}```. Does it mean that the code of the experiment itself has to be updated too ? – Thibault C. Jun 17 '21 at 14:36
  • In general new versions of jsPsych are not guaranteed to be backwards compatible. I suspect that the easiest way to do this would be to either summarize reaction time data manually (I think `jsPsych.data.getData()` exists in earlier versions and could be a starting point) or to replace all of the jsPsych code, including plugins, with version 6.3.0 and then adapting the experiment code to the new plugins. – Josh Jun 18 '21 at 14:31

0 Answers0