Howdy, Stranger!

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

Supported by

[solved] Flexible trial order -- adaptive designs

edited June 2013 in OpenSesame


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:

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,



  • edited 4:55AM

    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?


    There's much bigger issues in the world, I know. But I first have to take care of the world I know.

  • mihmih
    edited 4:55AM

    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!

  • edited 4:55AM

    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.

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.

Sign In or Register to comment.