| Reference | Downloads | Github

Randomization across blocks without repetition of stimuli?

Hello, I’m mostly new to PsychoPy and I’m using the builder on Windows 7. My goal is to randomly present 60 photos across two separate blocks without repetition (the first block should only present 7 photos and the second should present the rest). I also have a separate block in-between that is unrelated to the photo tasks.

I’ve figured out how to make the first block end after randomly presenting only 7 of the 60 photos using a code snippet, but I can’t seem to get the second block (which comes later in the flow) to finish the photoset without repeating the 7 photos already presented. Is there some intuitive way to do this that I am missing?

I’d appreciate any suggestions.


I would

  1. Create a code component in a routine in the beginning of your experiment. This generates a lists of image-indicies. So under the “Begin Experiment” tab, do:
all_rows = range(60)
shuffle(all_rows)  # randomize order
  1. Now, I assume that you have a loop around each block. Edit that loop and in the “Selected rows” enter $all_rows[:7] for the first loop and $all_rows[7:] for the second loop. This just picks out the appropriate rows numbers and since that list was randomized, they will be random. Naturally, you can edit variable names and 7 to anything you’d like.
1 Like

@patrick did that answer your question? If so could you tick solved? thanks

Sorry Jon, I haven’t had a chance to give this a go yet, but it looks like it will work out. I will be sure to tick as solved when I can try it out!

This looks like it will work! Thanks!