Randomly but always on the same position


I am trying to build a picture comparison task (PCT) with psychopy.

In the PCT paradigm, participants perform an ongoing task consisting of a series of trials in which they see a pair of images appear on the computer screen. In each trial, participants are asked to indicate whether the pairs of images are identical or different by pressing the corresponding key on a standard computer keyboard (“L” = identical; “D” = different). They are also asked to perform an additional task which consists of remembering to press a specific key on the keyboard (“Y”) when a picture of an animal appears on the screen. My block consists of 90 ongoing task trials and 6 additional task trials. The ongoing task trials are randomised.

My problem: I would like to randomize the 6 additional task trials but have them always appear at the same position, i.e. every 15 trials.

Any help with this would be hugely appreciated. :smiley: :pray:


So do you need to shuffle an array containing [0,1,2,3,4,5] and then select the task trial using [loopIdx%6] where loopIdx starts at -1 and adds 1 at the start of each loop.

1 Like

Thank you for your response @wakecarter !

Therefore it is necessary to insert a code in the loop with the loopldx function. At the moment my table contains both the 90 trials for the ongoing task and the 6 trials for the additional task. Could you suggest an example of code so that I can apply this function to the paradigm?

Here is an example of my paradigm and the spreadsheet in question below:

PCT_task.psyexp (33.5 KB) Stimulus_test.xlsx (12.0 KB)