psychopy.org | Reference | Downloads | Github

Mixing sequential and random order for a block

I am trying to run a pseudorandom block in which I am presenting 24 images in a random order but I need to make sure the first two and last two images are fixed across multiple iterations of the programme. Could anyone help me implement this pseudorandom order for my task? I primarily used the builder version and currently the whole block is set to random order:

# set up handler to look after randomisation of conditions etc
act_block_1 = data.TrialHandler(nReps=1, method='random', 
extraInfo=expInfo, originPath=-1,
trialList=data.importConditions('act_block.csv'),
seed=None, name='act_block_1')
thisExp.addLoop(act_block_1)  # add the loop to the experiment
thisAct_block_1 = act_block_1.trialList[0]  # so we can initialise stimuli with some values
# abbreviate parameter names if possible (e.g. rgb = thisAct_block_1.rgb)
if thisAct_block_1 != None:
for paramName in thisAct_block_1:
    exec('{} = thisAct_block_1[paramName]'.format(paramName))

for thisAct_block_1 in act_block_1:
currentLoop = act_block_1
# abbreviate parameter names if possible (e.g. rgb = thisAct_block_1.rgb)
if thisAct_block_1 != None:
    for paramName in thisAct_block_1:
        exec('{} = thisAct_block_1[paramName]'.format(paramName))

Thanks in advance,

Mo

@movivi, you could still use Builder for this with no coding required. You would need 3 routines, all the same, except each routine has its own loop. The first routine would have a loop of 2 trials presenting the images in sequential order, the next routine would have a loop presenting the images in random order, the final routine would again have a loop of 2 trials presenting the images in sequential order. These loops could be nested within a loop that repeats blocks of your trials e.g., see image attached.

2 Likes