Help with "nested lists"


I am looking for help with “nested lists” for lack of a better term (I used E-Prime prior to PsychoPy).

Essentially I am presenting 2 stimuli, one on the left and one on the right. There are then 3 conditions per stimuli. I have a conditions file with:

stim_left stim_right
cond1 cond1
cond1 cond2
cond1 cond3

Is there a way that I can tell PsychoPy that the image file it wants is within a folder called cond1? It is easier if I can load all of the files into their own conditions files, rather than having to have a conditions file 1000s of images long because of all the pairings.

Thank you

You could preload your files into separate cond1, cond2 and cond3 lists and then .pop() from the appropriate list during the trials loop.

Have a loop at my trial switching demo for how to load from a spreadsheet into lists in code. My PM and independent randomisation demos preload using a loop.

Fantastic I will have a look into them.

Out of curiosity, how well would this work with a larger conditions file? There are quite a few additional on screen things that happen are within the conditions file (as it’s the only way I could figure to get it working), plus correct answers, different fixations, locations and delays as well.

I’d broadly categorise experimental variables into three types.

  1. Ones that should be fully specified in the main trials.
  2. Ones that should be counterbalanced but independently randomised from the specification of the main trials (either to prevent confounding, or to avoid needing more trials than would be reasonable for the study).
  3. Ones that can be randomised.

For example, I might randomise four response positions in a multiple choice (3), rather than ensuring that the correct answer appears in each of the four locations 25% of the time (2) or repeating each trial four (or even 24) times so the correct answer appears in all four of the positions (1).