Creating a super loop that randomly runs sub-loops
I have an experiment where there are 4 possible pairs of stimuli, hence 12 permutations. I have 12 loops, each loop represents a permutation. Each permutation has to be run twice in a row, in order to be a 2-back task. For example AB AB, BA BA, AC AC, etc... Each permutation has to be picked randomly, and then run sequentially. I created 12 loops that repeat 2x sequentially, and put those into a "super-loop" that is supposed to run them randomly. However, the super-loop runs them sequentially, because the 12 loops are within the same sequence. I would have to create 12 sequences (one of each mini-loop) to run them randomly. Is there a quick way of doing it without extensive coding? I am not a Python expert so I am trying to minimize the need for coding! Many thanks!
Comments
Hi Daxide,
If all that you'd like to do is randomize the order of
'block_loop_1' and 'block_loop_2' then perhaps this could work:
http://forum.cogsci.nl/index.php?p=/discussion/123/solved-ranomization-problem#Item_5
But I'm not entirely sure about what type of sequence/randomization you need, I noticed there are also different coordinates in the smaller loops, should they be repeated or randomized, and if so in what way, etc. In any case let me know if the above solution is not sufficient
Yes, that is what I wanted to do, and that indeed worked! Thanks!
Just to answer your question: The coordinates in the smaller loops should be repeated sequentially for example ABAB, CDCD...like 2-back task. I just set order sequential and repeat each cycle 2x to achieve this. Now I have to create 12 smaller loops corresponding to all the permutations (4 elements by 2). I am sure there is a faster way than creating 12 small loops and looping over them randomly but if it works I am happy as I don't have the time to think about a more elegant solution!
Right, good that it works, one way to perhaps reduce the number of loops is define the target_ID in the larger loop, randomize this loop, and define only the coordinates in the smaller loops, in the attachment an example with only one set of coordinates. Good luck.