Routine order randomization & Conditional stimuli display

Hello everyone,

I have been trying to build an experiment on PsychoPY and kind of got stuck at a certain point. I will try to describe the design & the problem as best as I can:


  • There are two stimuli: Images (3 different types; let’s call them A, B and C) and shapes (3 different types. Let’s call them X, Y and Z). And each image is related / connected to a particular shape type.


  • Each image type is presented 10 times. And 8 out of 10 times, the shape will be presented centrally on the image towards the last seconds of that image display (Example: Image A is shown for 10 seconds. But starting from 7th second, the shape X appears on the image and then they together disappear at the end of 10th second)
  • There is an inter-trial interval as well. Just a blank screen.

As seen in the image below, I created 3 routines. In the first one (“Acquisition_1_cs_1) Image A (“image_2”) is displayed and followed by shape X (“cue_circle_2”). The other two routines are identical to this one, only the image and the corresponding shape differs.

(Note: In the picture, it looks like the shape (cue_circle_2) appears at the beginning of the image but this is not the case. I define the start of the appearence of both stimuli with $jitter and it works, for some reason the PsychoPY shows the timeline this way. Just wanted to explain it. I have no problem regarding the timing - at least for now :smiley: - but rather have problems about other things which I will describe below)

And the loop properties can be seen in the picture below: The loop is iterated for 10 times as we want each picture to be presented for 10 times.

So, the questions & problems:

  1. I would like the order of the routines within the loop to be random rather than sequential. How could this be achieved?

Solutions that I tried for Problem 1:

  • Creating only one routine and make an excel file with a random order of the images so that they can appear in a random order. However, I could not figure out how to make a different shape appear for the respective image within one routine. Hence, I created three different routines.
  1. I would also like to present the shapes at the end of the images only for 8 iteration of the loop. For the rest of the 2 iterations, I would like the shapes not to appear. How can this be done?

Solutions that I tried for Problem 2:

  • I tried to make additional separate routines which do not include the shape stimuli (say, “Acquisition_1_cs_1_extra”) And make ithat one loop for 2 times, and make the other actual routine loop for 8 times (“Acquisition_1_cs_1”). However this did not make sense because again, I would like the order to be random (i.e. I don’t want the routine “Acquisition_1_cs_1" to appear 8 times in a row sequentially…)

Any help / ideas would be appreciated. Thank you! :blush:

Hi @grimfandangosh, I think it’s best to try to reduce it to one routine. In this routine you could have all three shapes present but for each iteration of the routine only show one of them using a variable in your conditions file. For example, you could set the duration of the shapes that should not be presented to 0. So your conditions file would look something like this:

image    shapeXduration    shapeYduration     shapeZduration
A.jpg      0                   0                 1
B.jpg      0                   1                 0

This would also allow you to not show any shape in some trials.
Hope this idea helps you out

Hi @ajus ! Thank you a lot! This worked perfectly :slight_smile: