Assign a block of trials according to participant ID

If this template helps then use it. If not then just delete and start from scratch.

OS (MacBook Air):
PsychoPy version (2022.2.5):

Hello, I am very new to PsychoPy, I only began to use it last week, so I apologise if I am unclear.

What are you trying to achieve?:
I have three blocks made of three loops each with very different routines in them that makeup my three conditions, ND, PR, and DS. Below is a picture of what it looks like right now.

I want participants to be assigned randomly to only one of the three conditions so that they see only one of the three blocks, but I also would want the number of participants assigned to each block to be equal across all three blocks. I am hoping to eventually run this online so manually assigning a participant a condition would not work.

What did you try to make it work?:
I have managed to get each block to be presented in a random order by having the routines of each condition surrounded by a loop, each with the nReps defined as a variable corresponding to an excel file column of which is connected to an outer loop. Below is a picture of the excel file.

Screen Shot 2023-01-29 at 4.06.40 PM

However, I do not know how to get only one block to show or for the block that is shown to depend on the participant’s ID.

All the forums and videos online seem to apply to assigning participants to different conditions via condition files with different stimuli such as the VESPR solution, or the +str(int(expInfo[‘participant’])%4)+’.xlsx’ strategy, or the examples from Blocks of trials and counterbalancing-PsychoPy v2022.2.5, whereas I am looking to assign participants to different blocks of trials, or in other words to the three different loops I have comprised of the three sets of very different routines, based on their participant ID so I am not sure where to go from there.

Any help would be appreciated and again I am sorry if this was unclear, thank you!

If you use one of my VESPR tools to give you a consecutive value for participant, you could try the following in a Begin Experiment code component tab.

ND = 0
PR = 0
DS = 0
if int(expInfo['participant'])%3 == 0:
     ND = 1
elif int(expInfo['participant'])%3 == 1:
     PR = 1
elif int(expInfo['participant'])%3 == 2:
     DS = 1

If you use the VESPR Study Portal then you could set group to be 1, 2 or 3. Alternatively, you could use the Pavlovia shelf to similar effect.

1 Like

Thank you for your solution Wakecarter! I decided to just run three separate experiments.

This tool will give rotating allocation to three different URLs if that’s helpful.

https://moryscarter.com/vespr/survey.php

2 Likes