Howdy, Stranger!

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

Supported by

Adaptive Processing Experiment


I am fairly new to programming and would appreciate it if someone could guide me through writing an inline script for an adaptive processing experiment.
Basically, the experiment's purpose is to find at which time interval between two stimuli can the participant achieve a 75% accuracy. The participant finishes one trial with a set time interval of 2 seconds and based on their accuracy of this trial, the duration between each sound stimuli increases or decreases until they reach a 75% accuracy. If they receive equal to or greater than 75% accuracy, then the experiment is finished. The time interval at which they were able to reach this accuracy is recorded.

Thus, I need to code an inline-script that can tell the program to decrease the "Duration" of the sound sampler by 500 milliseconds, IF the the accuracy is below 75%. How can I access the "Duration" element in the sampler through my inline_script? Please let me know, thank you so much!!



  • HI Sarah,

    the attached experiment should get you started.

    Some more thoughts though:

    If they receive equal to or greater than 75% accuracy, then the experiment is finished.

    As accuracy has to be calculated cumulatively, it is possible that you will have 100% on the first trial, just by chance. Therefore, you may want to you use some other metric to make sure that participant can actually reach it. For example, you could skip the first 10 trials, before you start adjusting the timing.
    Similarly, if your participant start out very poorly and respond incorrectly the first 20 trials, they will have 0% accuracy. But if they then, start to produce correct responses, it will take them at least 60 more trials (60/80) to reach the criterion and the timing would be adjusted for all 60 trials. But of course, if they respond correctly 60 times in a row, you wouldn't say that they need the timing after 60 trials to get the task, but rather the one after 20(ish). Do you know what I mean? So also here, you might to think about alternatives, e.g. measuring accuracy/adjusting the timing every 10 trials or so.

    How can I access the "Duration" element in the sampler through my inline_script

    You should check the beginner's tutorial:
    the power of Python in Opensesame:
    and the importance of sequences for Opensesame:

    Basically, you can set an experimental variable in an inline_script like this: var.dur= 500. In the sampler item, you can add a variable to the duration field so that it is being determined on run time. Simply like: [dur]. This syntax basically means, that the field duration will be filled with the variable var.dur

    I hope this helps. Let me know if you need further advice (but give it a try first yourself).


Sign In or Register to comment.