psychopy.org | Reference | Downloads | Github

Trouble with randomization

Hello everyone! We are having some trouble with our presentation. I am fairly new to PsychoPy and have learned everything from google and this website.

What we currently have is 8 trials. The first 6 trials each have 4 photos that its pulling from, as well as a black screen to act as a jitter. What we are trying to do is have PsychoPy randomly select 1 photo from each of the 6 trial categories, with a total of 6 photos. The 7th trial has 12 photos that we would like it to randomly select 5 from, and the last trial has 5 pictures and we want it to randomly select all 5 pictures just in a random order.

After we figure out the randomization within each trial, we also need to randomize the order that the trials go in (aka, trial 1, trial 8, trial 6, etc) so that the pictures show up in a random order each time.

Thank you all ahead of time for your help!

The design is a little hard to wrap my head around from this description, but I can tell you what tools you’re going to want to use:

  1. PsychoPy’s TrialHandler. Look under demos -> expControl -> trialHandler to see how those are put together. Basically you feed them a bunch of info for your trials in a dictionary and it automatically randomizes them for you. Probably your best bet for the last step.

  2. Make lists of your stimuli, use random.shuffle() on those lists, pick first N options after shuffling.

Those are your basic options for randomizing things, you just need the data for your experiment organized in a particular way to allow you to do that.