URL of experiment: Pavlovia
Description of the problem:
I have a conditions file consisting of 40 words (for the WNW routines), and another consisting consisting of 8 words (for the PM routines). I want the program to randomly sample from the WNW list and then terminate the loop after 5 trials (WNW routine), then randomly sample 1 trial from the PM list and then terminate (PM routine), and so forth. There are a total of 8 WNW routines and 8 PM routines, so by the end it will have gone through 40 WNW trials and 8 PM trials. The key is to randomly sample without replacement across all the lists (i.e., none of the 40 WNW trials are repeated).
Iâve gotten this to work on the Builder with the following codes:
############Python#########################
Routine_1 - Begin Experiment
all_rows = list(range(40))
shuffle(all_rows)
all_PM_rows = list(range(8))
shuffle(all_PM_rows)
WNW - Begin Experiment
Python
wnwCount = wnwCount + 1
if wnwCount >= 5:
trials.finished = 1
#####################################
And then then in the wnwTrial Loop:
However, it wonât initialize in Pavlovia.
###########JS##########################
Routine_1 - Begin Experiment
all_rows = [âŚArray(40).keys()];
util.shuffle(all_rows);
all_PM_rows = [âŚArray(8).keys()];
util.shuffle(all_PM_rows);
WNW - Begin Experiment
wnwCount = (wnwCount + 1);
if ((wnwCount >= 5)) {
trials.finished = 1;
}
#####################################
And then then in the wnwTrial Loop:
I suspect the issue is coming from the âSelect Rowsâ column in the loop, but not sure how else to insert the specific row information. I realize there are probably more elegant ways to do this, but it generally works for our purposes. Was hoping maybe someone had a relatively quick/simple solution.
Here are some relevant discourses where I pulled the codes/procedures from: