psychopy.org | Reference | Downloads | Github

Insert a routine randomly to be presented only 3 times

Hello,

I have 50 trials in each block in a visual search task and I have three routines:

-stimuli presentation and participants response
-feedback
-second task

(I have inserted a loop in the flow panel which includes these 3 routines)

Since the second task is pretty much like a sanity check, I only want it to be presented randomly only 3 times. So essentially, in 3 out of the 50 trials in each block i want this routine with the second task to appear, after the first two routines are over (i.e. participants have been presented with stimuli and responded and were provided with feedback). I should insert a code at the beginning of this routine right? Do you have any idea how can I do that?

Thank you anyway

There are probably countless ways to do this, on top of my head I would go this way:

  • make a list with the number 1 to 50 and shuffle it once (with loop number = 0 or in another routine)
  • with a code component set a variable (e.g. myCounter) that start at 1 and goes up by one after the stimuli presentation and participants response
  • in the second task routine place a code component that says something like “if myCounter is different from the first, second or third item from the list, skip the routine”

To have the second tasks more evenly spread, you can shuffle 3 list instead on one (e.g. number 1-16, 18-33, 34-50)