Fixed random order, between participants- multiple conditions files?

OS: Win7
PsychoPy version: v1.85.4
Standard Standalone

I am trying to set up a two alternative forced choice task for a statistical learning language experiment. I have 4 fixed random orders for the 2afc word pair conditions each with a corresponding conditions file. I would like to be able to randomly select between the fixed random order conditions files so that the conditions differ between participants. Each participant will only complete one set of conditions=one fixed random order=one conditions file.

Is it possible to input all of the conditions files into the script and get Psychopy to randomly select the conditions file it uses each time the experiment is run (for each different participant)?

At the moment, I have simply given all of my fixed random order conditions files the same name and set up that pathway in builder view. So, I have to manually change the conditions file which is in the selected folder before each participant.

So I just wondered if it would be possible to set this up in the Builder to make it easier and reduce the possibility of me making errors.

Thanks very much in advance for all your help!

Hi @FrancesD,

For this, you could export your Builder code into Coder, and enter the following code before the dlg dictionaries are created, and then index the first shuffled condition as your experiment condition:

conditions = ['A','B','C','D']
shuffle(conditions)
# In the dictionary used to create dlg fields, called expInfo, add the key value pairs 'Condition': conditions[0]
expInfo = {'session': '001', 'participant': '', 'Condition': conditions[0]}

This will randomly select the condition file you want. You can then set the name of the conditions file in trial handler to:

expInfo['Condition']+'.xlsx' # order whatever your file extension is

Hi, I am a newcomer to psychopy. I would like as well to run an experiment with one condition file chosen randomly from several condition files (excel). The first part, I could do. But the second part of the solution, I do not get and could not make psychopy to choose from files. What should one do, so that the one of the condition files would be chosen randomly for each participant?

Hi @fatemene, there is a better way than that suggested above, that can all be done from Builder. Add a code component, and in the “Begin Experiment” tab:

conditions = ['A', 'B']  # where A and B are the names of your Excel files (without the extension)
shuffle(conditions)  # randomize the order for later use

Now, in your loop handler, add the following for your conditions file:

$conditions[0] + '.xlsx'  # This will create A.xlsx or B.xlsx

All you have to do is rename the entries in the conditions variable above to those in your own experiment. If you want to save a log of the condition file selected, then in your “End routine” tab,
add:

thisExp.addData("Condition", conditions[0])

Hi, Thanks a lot for the very clear and precise help. It worked really fine.