| Reference | Downloads | Github

Selecting stimuli without replacement over multiple blocks



I am trying to create a multi run fMRI experiment that has multiple runs with a 2 minute break in between each run. There will be 60 stimuli and 5 blocks so for each block I want to randomly select 12 of the 60 stimuli. However, I want to make sure stimuli that showed up in previous blocks will not appear in later blocks. Is there some way to do this in Builder?


You need to define what you mean by a “block”. This term can mean many things (conceptual and/or pragmatic) in terms of experimental design and procedure.


Sorry about that. So when I mean 5 blocks I mean 5 runs. In each run 12 stimuli are presented and then participants answer a question. I have it set up like this right now. It’s just 2 runs right now, but it will be 5 when I’m done.

What I want to do is have 12 stimuli from a list of 60 presented in each run. In between these runs there will be a 2 minute break. I put the csv file of the 60 stimuli in each loop. The problem is once the first run is over and the experiment hits the trial_2 loop there is a chance that stimuli that were previously shown in the first run will appear again. Is there a way to make Psychopy randomly select 12 stimuli from a list of 60 and not use any of the previous 12 stimuli in the next run?


As a rule of thumb in computer programming (and under the hood, that is what you are doing): the moment you start duplicating things, you know you’re on the wrong path.

You only need one loop here and one stimulus and question routine. After them, insert a third routine in that loop called “break”. In that routine, insert a code component. On the “begin routine” tab of that code component, put something like this:

# only run this routine on every 12th trial from the 12th onwards:
# (counting from 0):
if trials.thisN not in [11, 23, 35, 47]:
    continueRoutine = False 

Put some component (e.g. a text component saying “Pause” or something) set to last for two minutes to actually implement the break period.