Unequal repeat times in a loop with different conditions
Hello:
I have met a problem in Opensesame. I have 2 conditions need to be presented in one loop, it would present the condition A or condition B, and the presented order of A and B is random. However, I can’t write the specific things of A and B, because the interior of A and B is also required to randomize.
When I was using the loop to choose the repeat times, I realized that for A I need to present 60 times, but for B, it only need to present for 40 times, they are unequal. However, in the loop it defaults to a fixed number of trials for the A and B sequences (i.e., the A and B sequences are presented with an equal number of trials).
I think condition A should be 60 times, while B should be 40 times, but I don't know how to make it. if there is any solution for it?
Thank you in advance! ☺️

Comments
Hi @Zehan,
I'm having some difficulty understanding your description but I think that what you mean is that you want to run two conditions (A and B) with different probabilties: A should run 60 times and B should run 40 times.
The simplest way is to create 5 rows in your loop: 3 rows with
conditionset to "A", and two rows withconditionset to "B". Then set the number of cycles to 20. That way you'll end up with 20 x 3 = 60 "A"s, and 20 x 2 = 40 "B"s.Note that with this solution, the task will run 3 As and 2 Bs per every five successive trials. If you want more randomization, you could create 10 rows (6 As and 4 Bs) and then set the number of cycles to 10. Or if you want total randomization across the 1000 trials, simply create 100 rows (60 As and 40 Bs) and set the number of cycle to 1.
Hope this helps,
Fabrice.
Hi @Fab ,
Thanks for your kind reply. It's my problem that I didn't articulate it clearly.
This is defintely the simplest way to solve this problem.
However, for the condition A, it will contain 60 different picture pairs( the pairs are not fixed, they are all random), as well as condition B, it will contain 40 different picture pairs( also, random). Because different combinations of pictures in A and B are presented randomly, therefore, if I devide the condition A into A1, A2, A3, condition B into B1 and B2, it will also devide the picture pairs in the big condition A & B, it may lead the picture pairs themselves can't be organized randomly with each other. I wonder if there is other solution that can allow the two different big conditions can have the different repeat times in a loop without deviding into small conditions that have equal repeat times. I don't know if I've made myself clear, please ask me if there is unclear. 😊
By the way, I have thought about building an array of Python script that containing all the trials of this exp, it can allow the picture pairs to combine randomly, and also presenting A and B randomly, but it will be super complex, and messy😫. Do you think it will be other simple way to solve this problem?
Thank you again!!!😺
Hi @Zehan,
I understand you don't want the pairs of pictures to be fixed and the same for all participants but I don't really understand the rest of your description.
Are you using different sets of pictures for conditions A and B or are they all drawn from the same set? How many pictures are you using? Are there constrains regarding the random selection of the pictures? (for example that a picture can only be picked once across all trials). Etc.
The solution may be more or less complex depending on what exactly you want to do.
For complex randomizations, the most flexible (and often then only) option is indeed to work with arrays of elements in Python (unless you plan to run your task in the browser, in which case you should use JavaScript) to set up your trials list, and then to populate the loop from the array as the task progresses.
Best,
Fabrice.
Hi @Fab ,
I will try to explain it clearly.
For the condition A and B, they are from the same picture set, this set has 120 picture inside.
When the experiment begins, the half of the pictures(60) will be allocated into condition A, and the rest (60) will be allocated into condition B.
The picture will be presented as pairs,( e.g. mouse-keyboard in condition A, and sunglasses-cat in condition B for the subject 1, while for subject 2, mouse-cat in condition A, and sunglasses-dog in condition B, I can't tell the specific pairs for each subject, becasue it is randomly allocated by the code).
For pictures, when they are allocated into condition A and condition B, it means the pictures in condition A will not present in condition B, as the example of subject 1 above, the mouse-keyboard will not present at condition B, but the picture pair will present twice in condition A(e.g., showing keyboard-mouse again in the condition A), in this case, each picture will present twice in the condition A; and you may have questions about the condition B, follow this thought, it seems that condition B has the same picture pairs as A, but I will not show the entirely picture pairs in condition B, this is becasue the experiment manipulation, so in the condition B , it will be present 40 picture pairs randomly.
I do not know if it is clear enough, please ask me about the unclear part.
I have done a lot of the random allocation about the picture pairs, but I was stuck in the repeat times. Maybe there is not other opition to devided the loop into 60/40 because of the complex randomation in this experiment, but only do the arrays of elements in Python......? However, I do not the experience of using python script to build the loop, that's why I asked at first......but if there are no methods, I will try😣
Thanks for your help and suggestions!
Best,
Zehan
I used the arrays in Python to solve this question 😁 😁 for the totally random problem, this definitely the greatest way to solve it!!