[solved] Flexible trial order -- adaptive designs
Hi,
I'm looking into Opensesame's abilities regarding adaptive designs. What I want is, to use Opensesame to construct all my trial sequences, use its logging and other facilities, but I also to be able to dynamically decide what trial will run next, with what exact parameter setting, and how many trials there will be in total.
I thought I can simply use an inline script in a loop that will figure out what to do next, i.e. determine the next parameter combination, set the corresponding variables and potentially adjust the number of trials in a loop. The latter seems to be possible:
http://forum.cogsci.nl/index.php?p=/discussion/3/solved-using-variables-to-set-loop-repeat
However, doing a self.experiment.set() in an inline script doesn't seem to be enough to communicate a a parameter to a predefined trial sequence. Without any variable definition in the loop Opensesame complains about an unknown variable. If I add a dummy definition
of this variable to the loop it doesn't complain anymore, but the set() has no effect on the remaining items in the trial sequence (inline script is first item in the sequence). I assume this is because the whole trial is somehow pre-crafted before it (and therefore the script) runs.
What is the best strategy to be able to use predefined trial sequences, but control trial order and trial parameters dynamically during the experiment?
Thanks in advance,
Michael
Comments
Hi Michael,
If you add a self.experiment.set('my_var', 'my_value') statement in an inline_script item at the start of a (trial-)sequence, it should work, but only if you add it to the prepare phase. This is because most of the trial is pre-constructed, as you point out. By inserting Python code to the prepare tab of an inline_script you can modify variables etc., before the sketchpads etc have been constructed.
Does this answer your question?
Cheers,
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Sorry for the delay, I forgot that there is no email notification. Indeed I had the respective code in the run phase. Moving it worked, thanks!
Good that it works!
And right, you should receive e-mail notifications if you bookmark a discussion with the big yellow star. That's not completely obvious, though, so I'll try to make that a bit clearer.
Check out SigmundAI.eu for our OpenSesame AI assistant!