psychopy.org | Reference | Downloads | Github

Randomizing routines in a loop to switch between number of images on the screen

OS (Mac OS High Sierra):
PsychoPy version (1.73.04):

What are you trying to achieve?:
I am designing an experiment in PsychoPy that relies on two conditions. In one condition, I need one image to be repeated on the screen two times, and in the second condition I need one image to be repeated on the screen three times. The images are randomly being assigned in a loop and filled into a routine that either has two or three copies of that image in it. The images are set to a specific size and position depending on how many images are displayed on the screen, and this is built into the routine. By the end of the loop, I need the participant to have viewed each image in each condition; so I need the participant to view each image in the two image copies condition and the three image copies condition.

I currently have two routines created, one for each condition I need to test. I can understand how I could build the loop to have one image shown in the two image copies condition and then shown again in the three image copies condition, but this may alter the results of my experiment. My question is, how can I use loops and routines in the PsychoPy builder to randomize the presentation of each image so that it is shown in both the one image copy and two image copy conditions, but not consecutively?

I am new to using PsychoPy, and would appreciate any advice. I hope my question and intentions for my experiment are clear. Thank you!

Everything you’ve described is straightforward to achieve in Builder except this constraint, which would require writing some custom code, or hand-crafting a fixed conditions file that incorporates this constraint, but at the cost of everyone experiencing the same fixed, pseudo-random sequence.