Hi All,
I’m trying to pare back an existing psychopy program to remove code so it will run online. The code is from the original IAT program that was written many moons ago for version 1.8x
The program has the following JS code that needs fixing - I have two questions to help try and point me in the right direction.
- The issue I think is with the itertools.chain function. It’s trying to flatten a list of lists. Is there an off the shelf way to do this? Or am I approaching this in the wrong way?
- Where is the code getting the ‘multiplier’ variable from? When I view the full code I don’t see it initialised anywhere.
Any pointers would be great. Happy to elaborate more if someone thinks they can help.
Justin.
var block_order, exemplars, exemplars_filename, list_multiplier, n_exemplars, participantNumber, trial_rows;
exemplars_filename = "stimuli.xlsx";
exemplars = data.importConditions(exemplars_filename);
n_exemplars = 5;
list_multiplier = 2;
function generate_trials(trial_type_column, multiplier) {
var a;
a = dict();
for (var i = 0, _pj_a = exemplars.length; (i < _pj_a); i += 1) {
a[i] = ([exemplars[i][trial_type_column]] * multiplier);
}
a = a.values();
a = list(itertools.chain(...a));
random.shuffle(a);
return a;
}
trial_rows = "";
participantNumber = 1;
block_order = 1;22