| Reference | Downloads | Github

Counterbalanced versions in Online experiments


I am trying to create an online experiment through PsychoPy. Each participant will be given a separate version, with a different order of stimuli. Is there a way I can do this in just one experiment file, so participants can, for example, enter a number before the experiment starts (i.e., 29) and the stimuli order will be set in a specific way that is designed just for them (i.e., would be different if participant used number 30, 31, etc…). Is there a way to code this in an online experiment - I believe it’s possible from my computer, but not sure how it translates online. Or would I have to design about 30 separate experiments with a different stimuli for each single participant for it to work online?

Thank you.

Don’t design 30 separate experiments!

I have two online solutions for this which might help.

I see it says
" In PsychoPy you can use the participant number to assign participants equally to multiple conditions by using:
condition = int(expInfo[‘participant’])%x where x is the number of conditions. This will assign values 0 to x-1."

Where on PsychoPY could I place this code? Would this indicate that if participant stated he was participant 30 → then the stimuli list will be displayed in the order set for participant 30 only? And where would I place the code that says “if participant30, then display stimuli in this order”.


What exactly are you trying to achieve. You don’t want random orders but you do want every participant to have a different order? If the issue is that you need to repeat the random order then you could use a seed of expInfo[‘participant’]

Here’s some information about seeds

Basically, I have 100 orders set up (not random) and each participant will have 1 of these orders.

If your orders are set up as different spreadsheets, e.g. order42.xlsx then you could use condFile = 'order'+expInfo['participant']+'.xlsx'. However, you might want to try condFile = 'order'+expInfo['group']+'.xlsx' using my portal instead which could repeat conditions where the participant didn’t finish.

Hey @wakecarter, I was wondering if you could still help me resolve this. I set the condition of my trial as ‘cb’+expInfo[‘participant’]+’.csv’ where cb = order, and I have the order files in the same folder as my study, but this is still not running the experiment. It says conditions file not found.

Thank you and much appreciated.

When setting file names in code you also need to either download all resources via Experiment Settings / Online or download the desired resources in code