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

1 Like

@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.

4 Likes

Sorry to bother you~
I have a similar question: I want to have the first colume of my loop excel “sequential” while the others are “random”, but I can not find a solution to this question because the Psychopy only allows for one loop.xlsx and one looptype in a loop.
Thanks a lot if you can spare your time to help me

1 Like

Did you find a solution?
I currently have the same problem. I need one of my excel columns read sequential whereas the other should be read randomly. Is this even possible?

Thanks! :slight_smile:

Sorry, I haven’t solved it. Maybe you can try to find an alternative solution :laughing:
I finally completed my experiment, but I can not remember why I raised this question :joy:

Too bad!
But thank you eitherway for your fast response! :slight_smile:
I will probably have to come up with another solution, then :smiley:

Have a look at my independent randomisation demo.

1 Like