Oddball paradigm with multiple pictures randomization without repetition

Hi,

I am trying to build/program an experiment, but I’m having quite some trouble.
Particularly, the task is an oddball paradigm with pictures. Four standard stimuli are presented simultaneously at the four peripheral points of the screen, while participants are asked to pay attention to the fixation cross in the center of the screen and detect variations of its dimension.

Inter-trial interval randomization (from 0.9ms to 1.1ms) was rather simple to code, as I put

fixDurMin = 0.9
fixDurMax = 1.1

in the “Begin Experiment” box, and

#Fixation cross duration
fixDur = randint(18,22)*0.05
#Document the duration in the logfile
thisExp.addData('fixation_duration', fixDur)

in the “Begin Routine” box.

For what concerns pictures randomization, everything went downhill. Nothing seems to work. I’ve looked at almost all related topics but I’m not able to make anything work.
The thing is, I have 10 pictures for the standard condition, and 30 pictures for the deviant conditions (three different conditions, 10 each). 85% of the trials should be standard stimuli, while for the three different deviant typologies, they will have a frequency of occurrence of 5% each.

The pictures should not repeat within each trial (remember that pictures are presented four each trial) and the same pictures should not repeat twice in a row.
Among all this, there is also the fixation cross which should randomly change, but for now my priority is pictures randomization.

Is anyone able to help me solve this problem?

Thank you very much!

Hello

do you mind showing us what you tried so far? What did not work specifically?

Best wishes Jens

Dear @JensBoelte,

I’ve attached the .psyexp as well as an example of my condition file.
As of right now, I’ve adapted the code provided by Mirjam in “Randomisation without consecutive presentations” (I’m sorry, I was trying to provide the link but an error occurred saying that new users can only attach two links), as follows:

Condition=[]
stimulus_list = ["Neu", "Happy", "Fear", "Gender"]
# select the images we want to present
# will always be fist X (X = length of images list)
mixedList=Condition[0:len("Neu")]
shuffle(mixedList)

double_stim = False
list_ok = False

while list_ok == False:
    for i in range(len(stimulus_list) - 1):
        # check for equal neighbours:
        if stimulus_list[i] == stimulus_list[i + 1]:
            double_stim = True 
            break  # can stop checking on this run
    if double_stim == True:
        shuffle(stimulus_list)  # try a new order
        double_stim = False
    else:
        list_ok = True  # Yay! The loop won't run again.

print(stimulus_list)

in the “load_random” routine, in the “Begin Experiment” box.

For now I’ve put mixedList=Condition[0:len("Neu")] as this first routine is meant to be the phase of familiarization with the task, so I don’t want the deviant stimuli to be presented yet.

How should the code look when also the deviants need to be presented? And how do I code that 85% of the trials should pick pictures from the “Neu” condition, and the remaining 15% of from each deviant ones (i.e., 5% “Happy”, 5% “Fear”, 5% “Gender”)?

Even more, currently the problem is that in each trial the same picture gets presented at the four peripheral points, but I want four different pictures. There is no repetition in subsequent trials, though.

Many thanks in advance!
Condition.xlsx (9.8 KB)
ProvavMMN2.psyexp (31.6 KB)

Hello,

ok, your experiment presents the same picture at the four positions because you tell it to do so, Image1 to Image4 take $Neu as stimulus.

Ok, just to make sure. You want to present in 85% of the trials a stimulus from the Neu-condition, in 5% from the Happy-condition, in 5% from the Fear-condition and the remaining 5% from the Gender-condition?

This can be achieved by constructing a list that contains 85% trials from the Neu-condition, 5% from the Happy-condition aso.

stimulus1 cond1
stim1 neu
stim2 neu
stim3 neu

stim17 neu
stim18 Happy
stim19 Fear
stim20 Gender

This will result in condition repetition across trials but with 85% trials from one condition you can prevent condition repetition. Stimuli will not be repeated. Assign these stimuli to one position (pos1).

Then add three more stimulus columns (and condition columns) you can assign those to the remaining three positions (pos2 to pos4). You can randomize the positions across the four stimuli such that pos1 to pos4 take different x-y coordinates on each trial.

Best wishes Jens