#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

# [solved] randomizing a sequence of four blocks

edited July 2013

Hi Sebastian.

I have this experimental structure:

``````My experiment
- experimental loop
-- block sequence
--- block sequence 1
--- block sequence 2
--- block sequence 3
--- block sequence 4
``````

Inside each block sequence there is a trial loop with a trial sequence inside.
I want to randomizing the four sequences inside the block sequence, but simply setting the random order option in the experimental loop doesn't work (I don't know why...).

In this post I have read that a solution for a similar problem is to set a order variable (in my case with the values 1, 2, 3, 4) in the experimental loop, an then use the "run if" statemant for all the permutations of the blocks order. But in my case I have to set 4! = 24 permutations! (

There does exist an easier method to randomizing?

Cheers,

Andrea

• edited July 2013

Hi Andrea,

Right, if you set a loop to random, it will only randomize the order of the loop. The order of the items in a sequence is always fixed. Still, you can mimic a random sequence quite easily with a simple inline_script. See below, some instructions are added as code comments.

Cheers!
Sebastiaan

``````from random import shuffle

# Uncomment for 0.25 and before
# exp = self.experiment

# Create a list of items that are part of the sequence
# These items must be present somewhere in the experiment.
# An easy solution is to add them to a dummy_sequence at
# the start of the trial and set the 'run if' statement of
# the dummy_sequence to 'never'.
item_list = ['item1', 'item2', 'item3', 'item4']

# Randomize the item order. Of course you can also do more
# complicated things, such as have the order depend on the
# subject nr, etc.
shuffle(item_list)

# First, prepare all items
for item in item_list:
exp.items[item].prepare()

# Now run them!
for item in item_list:
exp.items[item].run()
``````

There's much bigger issues in the world, I know. But I first have to take care of the world I know.
cogsci.nl/smathot

• edited 12:18PM

I have tried it just now and it works like a charm. You are the Genie of the Lamp.

Thank you very much, Sebastian.

• edited 12:18PM

Hi,
I am brand new in Open Sesame and I know nothing about Python (I have been using SuperLab before). I have been trying to what Sebastiaan suggests, but I am not getting results. Could somebody explain it to me like "Open Sesame for dummies"?
I need to run several blocks of 36 sequences (1 fix point+1 sentence+ 1 question about the previous sentence) in a random way (the presentation of the 36 pairs of sentence+question must be random), and collect RTs and yes/no answers.
I understand the structure is pretty much like the one Andrea has, but with more sequences.
And another thing: I am having problems with the excel with the collected data. It seems to be all mixed up and RTs are not recorded (or so it seems)...and I don´t know how to solve it.

Thanks!
Gabi

• Hi dear