[solved] repeat cycle
Hi all,
I'm programming an experiment in which I need to repeat a loop until the accuracy is 100%.
I have a loop with 21 trials presented randomly. The 21 trials are divided in 7 condition composed by three trials each.
For each condition (by using some inline script) I have defined a variable for recording and updating the accuracy of the three trials (so from 0 to 3). Thus far everything works fine.
What I'd like to do is to repeat the conditions (all of the three trials) in which the participant has make at least one error.
I have tried with a repeat_cycle by in this case all the 21 trials are repeated.
How can I solve this problem? Is there any way to repeat only some conditions by picking up only the corresponding trials and not the entire list?
Thank you in advance!
Cheers,
Andrea
Comments
Hi Andrea,
Is your experiment random on trial level or only on condition level? I mean, are the 3 trials of one conditions always presented after each other, or are all 21 trials presented in a mixed fashion in the initial round?
If they are blocked, you do something like this:
1) In a
loopitem, select the condition you're going to run2) Within this loop, you put an
inline_scriptrunning each trial of a condition in awhileloop. So,while accuracy != 100: run_trial, or something similarWas this helpful?
Let us know if you need more detail.
Eduard
Hi Eduard,
My experiment is random on a trial level, so that my 21 trials (3 for each condition) are presented totally random. I have only one loop (and the same sequence) for all the trials.
For example, I need to pick up only three out of the 21 trials of the original loop.
Could your suggestion work also in this case?
Anyway, I'll try and I'll let you know!
Thank you so much!
Hi Eduard,
I've tried your suggestion but it doesn't work: using the while loop the experiment presents only the first trial of the first condition to infinity.
How can I do?
Thanks,
Andrea
Hi Andrea,
This makes things a bit more complicated, but it still is doable. Here a (very general) way of doing it (sorry for the lack of detail).
1) First you ran your initial
loopandsequencein a rather basic way (all 21 one trials randomly). It is super important that you keep track of the accuracy of each condition. For example you can use adictionary, with the conditions as keys and the number of total trials, accurate trials and average accuracy as values (Don't forget that you would have to initialize thedictionarysomewhat earlier in your script.It might also be handy to keep track of other trial information, like which stimuli were drawn, etc.
2) Now the tricky part begins. You have to decide which of the conditions need a repetition and create a new loop on the fly. I recommend doing it in an
inline_script, because you have more freedom there. The idea is to select every condition that needs a redo and put its trials into the new pool. This procedure should then be repeated until the pool is empty, so every condition has 100% accuracyDoes this help?
Good luck,
Eduard
Hi Eduard,
thank you so much for your help. I'm working on it but I have some troubles in appending the trial: which information do I need to put in this line?
Thanks again,
Andrea
Hi Andrea,
Every information that you need to show your stimuli. This can be anything, but boils down to What, How, When and Where. What your goal is in the second loop (the one in which you repeat the conditions that haven't 100% correct, is to show the same trials again, right? So, you have to make sure that you know what to present.
Does this make sense?
Eduard
Hi Eduard,
thanks to your suggestion I have figured out that problem, so that I have created a new list that the include all the trials I need to repeat.
However I can't display the new trials; I've tried with
but it doesn't work. The sequence is exactly the same of the previous loop (basically I have created a second loop with the same sequence and at the beginning of this new sequence I have inserted the inline_script for selecting only the trials I need)....is it right? Or I need to specify the entire sequence in the inline_script?
Moreover, I'm not sure of the right position of the inline_script....
Thanks again,
Andrea
Hi Eduard,
sorry for bother you again (I'm quite new of Opensesame and Phyton code in particular)!
I've tried in a second way to do it: instead of randomize the 21 trials, I've randomized only the condition level.
I've created one big loop that contains 7 small loops (one for each condition) of 3 trials each. I've used an inline code to keep track of the accuracies as you suggested.
At the end of the big loop I've inserted a repeat_cycle plug-in that re-runs the big loop only if one of the accuracies is not 100% (and re-runs only the small loop in which the accuracy is less than 100%).
Everything works fine but there is only one problem: when all the accuracies are 100% (and so the repeat cycle should stop) the experiment remains freeze on the last screen of the last trial, and does not continue to the next phase. The only way I can stop the experiment is to press the esc button.
How can I solve this? Is it an error in the repeat_cycle plug-in?
Thank you so much again,
Andrea
Hi Andrea,
Sorry for not having responded earlier.
Your problem sounds, that you haven't defined a break criterion. Would you mind sharing your experiment with us, or at least your settings for the
repeat_cycleplugin? Without more information it's hard to offer a solution.Thanks,
Eduard
Hi Eduard,
No problem!!! I figured it out! It was a problem in the break criterion.
I've replaced the repeat_cycle plug-in with an inline_script in which for each condition I've used a while:
Thank you so much!!
Andrea
Good to hear.
Eduard