#### Howdy, Stranger!

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

Supported by

# Randomize loops

Hello everyone!

Does anyone here knows how I can randomize the presentation row of 7 loops in Open Sesame? I have followed the steps on Mathot's video about the 3 loops and tried to "expand" it, but unfortunately afte the first loop my eperiment ends... Any ideas ?

P.S. Happy New Year!

Vasileia Christou

• Can you provide a little more information about your design? If I understand your message well, you want to randomize the order of presentation of 7 loops (blocks). Is every loop supposed to be presented once? Which video are you referring to exactly?

Best,

Fabrice.

• Yes, every loop should be presented just once but in a different order to every participant. The video of Mathot I am referring to is this one https://youtu.be/zP8ucRtWU5g but includes only 3 loops when my exp has 7. I used 2 types of code.

1)if self.get ('subject_nr')%7==1:

b1=0

b2=1

b3=2

b4=3

b5=4

b6=5

b7=6

elif self.get('subject_nr')%7==2:

b1=6

b2=0

b3=1

b4=2

b5=3

b6=4

b7=5

elif self.get('subject_nr')%7==3:

b1=5

b2=6

b3=0

b4=1

b5=2

b6=3

b7=4

elif self.get('subject_nr')%7==4:

b1=4

b2=5

b3=6

b4=0

b5=1

b6=2

b7=3

elif self.get('subject_nr')%7==5:

b1=3

b2=4

b3=5

b4=6

b5=0

b6=1

b7=2

elif self.get('subject_nr')%7==6:

b1=2

b2=3

b3=4

b4=5

b5=6

b6=0

b7=1

else:

b1=1

b2=2

b3=3

b4=4

b5=5

b6=6

b7=0

exp.set('b1',b1)

exp.set('b2',b2)

exp.set('b3',b3)

exp.set('b4',b4)

exp.set('b5',b5)

exp.set('b6',b6)

exp.set('b7',b7)

With this one everytime only the first loop would play and then the experiment was "ending successfully".

2) For the second I tried my luck with some Python:

def rotate(v,n):

v=list(v)

for i in range(n):

c=v[0:len(v)-1]

c.insert(0,v[len(v)-1])

v=c

return(c)

v=range(7)

n=self.get('subject_nr')%7

v=rotate(v,n)

for i in range(7):

b='b'+str(i)

exp.set(b,v[i])

In the above situation the experiment was running properly ( all the loops) BUT the order of the loops never changed :/

• Before anything, regarding the first method, are you sure you set your main loop to run 7 times? The problem you describes suggests it runs only once. If so, the code might be working but only one block ever gets to be executed.

Best,

Fabrice.

• I don't actually have a main loop but a main sequence in which i have the 7 loops

• If your main sequence is not part of a loop running as many times as you want blocks to be presented, only one block will be presented.

In the video tutorial you mentioned, you can see that the main loop contains three rows and three cycles:

Best,

Fabrice.

• Did you get your experiment to work following @Fab's suggestions?

To avoid any confusion, I just want to point out that @sebastiaan's video is about counterbalancing the order of loops, and not about randomizing it (as the topic of this thread and your description of the problem suggest).

Cheers,

Lotje

Did you like my answer? Feel free to