Randomizing without repetition

OS Win10:
PsychoPy version 2020.2.10
What are you trying to achieve?:

Hi all, I’m very ney to PsychoPy and Python so I’m sorry if this is a very basic question. I’ve tried going over answers in the forum and did not quite manage to find a solution.

  1. I have a list of 120 stimuli out of which I need to choose 90 for the experiment. Of the 90 I need them to be randomized into three conditions without repetition.
  2. I want each condition to appear in a pseudo-random order i.e., not more than twice in a row.

What did you try to make it work?:
1.At the moment I managed to randomize the stimuli but not to withhold repetition.
2.at the moment the conditions are completely randomized, I didn’t know what to do to control the more than twice in a row issue.

What specifically went wrong when you tried that?:
stimuli are appearing in a random but are repeating more than once

Hi!

Currently there is no simple ‘out of box’ approach to pseudorandomistion in PsychoPy. For now, we recommend that you make your conditions file in the order that you want and then set your loop type to be ‘sequential’.

If you want a new pseudorandom order for each participant (e.g. 30 participants with their own order) make a unique file for each participant (e.g. ‘conditions1.xlsx’, ‘conditions2.xlsx’ … ‘conditions30.xlsx’)*. Then in the ‘conditions’ field of your loop use $'conditions'+expInfo['participant']+'xlsx' - where 'expInfo['participant'] will be the number you enter into the participant field of the gui at the start.

Hope this helps,

Becca

*It will ptobably be most useful long term to make a python script to write your conditions files - and save manual work. Even if you are new to python the skills you learn for this kind of script are a good intro - here is a script that I use for a similar purpose - creating a large number of counterbalanced conditions files https://gitlab.pavlovia.org/lpxrh6/counterbalance_conditions.

Thanks for your quick reply! This answers my second issue perfectly. I still haven’t quite figured out though, how randomly choose stimuli from a list without repetition.

Hello

I am asking simply to understand your experimental intentions better. Why do you use 120 items when you only need 90?

Best wishes Jens

Hi,

If you have a conditions file that you feed into your loop and set loop type to random, that randomly samples without repetition (repetition is determined by the nReps argument if you do need reps :slight_smile: )

Thanks,
Becca

Thanks for your reply, the reason for the extra stimuli is that this set of stimuli is being used in two studies one with four conditions (30 stimuli per condition) and the one I consulted about is with only three conditions (30 per condition).

Thanks again,
Omer