Howdy, Stranger!

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

Supported by

problem with randomization code

Hello everyone!

I try to pseudorandomize the presentation order of my stimuli (videos). I used the code that was mentioned in a previous post in the forum (https://forum.cogsci.nl/discussion/80/solved-pseudorandom-order) with a few alterations in order to cover my restrictions (we don't want to have two target stimuli in immediate succession as well as more than 3 neutral stimuli).

The code is the following:

at the start of the experiment:

and at the start of a trial:


It worked perfectly when i had a small number of stimuli (around 25), but when i inserted all the stimuli that i wanted to include in my experiment (66 stimuli), it got stuck and the experiment didn't start at all (it was not responding). I use the latest version of opensesame (i tried it in an older as well and i had the same issue).


I would really appreciate any help with this issue.

Best regards,

Rania

Comments

  • Hi Rania,

    it got stuck and the experiment didn't start at all (it was not responding)

    That is probably an infinite loop then. It occurs, because your requirements are so strict that Opensesame can't find a sequence that satisfies them all. I haven't systematically looked at all the possibilities, but having 25 ones and 41 zeros, with the restriction that there is at least 1 zeros between ones, and at least 1 one every 4 zeros sounds rather restrictive. Perhaps you could lose the restriction somewhat? It might not be possible otherwise?

    Eduard

    Buy Me A Coffee

  • Hi @rania_tach,

    @eduard is right that the conditions might be too constraining to allow solutions to be found, but I also wonder whether your "for ... in ..." loop is correct. It looks as if it starts at 0 and goes up to len(video_type) but then your conditions evoke i-1, i-2 and even i-3. That seems a little odd because when the loop starts, I'm not sure what i-1 and i-2 would be equal to... But for some reason if the program considers that video_type[-1], video_type[-2] and video_type[-3] are 0, then I th ink your code would reshuffle forever... I might be wrong, though...

    Best,

    Fabrice.

    Buy Me A Coffee

  • Yes, @Fab you are right. The code is essentially wrong, for the first few i's it wraps around the list and compares the first item in the list to the last three in it. Not quite what @rania_tach wants, but also not the source for the problem. In fact, there is a good chance that the wrong code would produce a correct result, provided that the conditions were tenable.

    Eduard

    Buy Me A Coffee

  • Hi Eduard and Fab! Thank you so much for your responses!

    Yes Fab you are totally right about this part of my loop. I was trying to avoid the code breaking whith the i, i+1 etc so i tried the i-1, i-2 and somehow it worked correctly when my list wasn't that big.

    However i see Eduard you are right about the strict restrictions and the lenght of the list. Both together must have made it impossible for the experiment to begin. I might try to randomize my list externaly and then insert it to opensesame and see how this could work or maybe as you suggest reconsider my restrictions.


    Again thank you both for the help!

    Rania

  • Hi Rania,

    It might help if you break down your long list of 60ish items into small chunks of 6 or so, that you shuffle each, and then concatenate them until you are happy. A similar approach worked for me, when I wanted to control certain intertrial features of my own sequence.

    Eduard

    Buy Me A Coffee

  • Hi Eduard,

    That sounds like a good plan! Thanks for the suggestion, i will try it that way.

    Best,

    Rania

Sign In or Register to comment.