Howdy, Stranger!

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

Supported by

How to implement a variable stop-signal delay in the stop-signal task?

Dear all,

I have activated your version of the stop-signal task (SST), but I would to implement an adaptive procedure that prolongs the stop-signal delay (SSD, i.e., the period of time between the target stimulus and the stop-signal) after each successful Stop-trial and shortens it after each unsuccessful one.

More specifically, at the start of the experiment the SSD should be 200 ms, and after a successful inhibition the SSD increases with 50 ms, and after an unsuccessful inhibition the SSD decreases with 50 ms (with a minimum SSD of 50 ms).

At the moment, the SSDs are fixed (that is, there are four standard different SSDs that will occur equally often during the experiment), but this makes the SST non-adaptive.

Can you guys help me out with this? Thank you in advance!



  • Hi Rubin,

    In the end of a trial sequence, you can add an inline_script and put this code in the run phase:

    # I don't know the variables in the SST task, so you'd have to change them if necessary
    if var.correct == 1:
        var.SSD += 50
    if var.correct == 0 and SSD >99:
        var.SSD -=50

    Also, the variable var.SSD needs to be initialized somewhere in the beginning of the experiment. So, you could add another inline_script somewhere in the beginning of a block or of the exeperiment and add the line; var.SSD = 200. Does this make sense?


  • Hi Eduard,

    Thank you for your quick response! Your code does make sense, but if I try that I get an error message :neutral:

    Are you able to check what's wrong? Here is the structure of my experiment.

    This is your code for the adaptive SSD that I've implemented

    But in the end, I get this error message:

    Maybe the problem is that my python inline script should be in the coroutine list (which isn't possible at the moment in opensesame)?

    Hope you can help me out with this!


  • Hi rubin,

    the variables var.SSD and var.stop_after have to have the same name. Otherwise, you can't do the operation var.stop_after + 50. Like the error message says, the variable does not exist.


  • Hi Eduard,

    Oh that was a stupid mistake .. However: I changed the 'stop_after' variables into 'SSD', and I still get the error message saying that SSD is not defined.


  • If you initialize var.SSD in the inline_script, you don't need the column in the loop table. In fact, this is the reason, you get the error you are talking about as there is no specified value in most of the rows.

    Does this make sense? Can you try that and let me know whether the problem was solved?


  • And also:

    There is an error in the inline_script "SSD_adaptive". In the second if statement, you have to replace and SSD >99 with and var.SSD >99. The variable SSD doesnt exist, but only var.SSD.


  • Dear all

    Thank you RubinCS for posing this question (I too am trying to implement a variable SSD), and thank you eduard for your answer, which was very helpful! I used the code you suggested and it worked. I have made a minor modification for the code: My loop contains a variable called stop_signal (with 0 = inhibit response) and I added this to the code “and var.stop_signal == 0”. As far as I know the SSD should only increase if the participant inhibits his response correctly and the SSD should decrease when the participant erroneously reacts although he should inhibit his response. If you don’t add this argument “and var.stop_signal == 0” then the SSD changes after every response (regardless of whether it was a stop trial or not). I’m not sure if my suggestion is of any use but it seemed to work for me (I’m rather new to OpenSesame)… I hope this helps!

    I have 2 follow-up questions and hopefully someone can help me out:

    1. At the moment the SSD increases continuously (given that my experiment will contain around 400 trials this means that the SSD could be somewhere around 2000ms for example). I want the SSD to be between 0 and 500ms (so 500ms should be the absolute maximum). How can I define this range from 0 to 500ms with 500ms being the top maximum?

    2. Normally the rate of stop trials is about 25%. I could adjust the ratio of stop signals in the loop and then adjust the amount of cycles in order to get a rate of 25% stop trials. Is there an another, easier way to get the intended rate of stop trials? For example some kind of weighting procedure?

    Thank you for your help!

  • Hi,

    I want the SSD to be between 0 and 500ms (so 500ms should be the absolute maximum).

    You can apply the adjustment only if the SSD is smaller than 500 ms. Or fix it, once it exceeds the limits:

    # compute the new SSD
    if var.SSD > 500
         var.SSD = 500
    elif var.SSD < 0:
        var.SSD = 0


    Is there an another, easier way to get the intended rate of stop trials?

    Can you elaborate a little more what it is precisely that you need?


  • Dear Eduard

    1. Thank you for your answer and your help!

    2. I'm sorry, I'm going to try to be more precise: In my stop signal task I would like to have 25% stop trials and 75% go trials (e.g. 400 trials in total --> 300 go trials and 100 stop trials). I solved this problem by creating 8 rows in a loop with 6 go trials and 2 stop trials and by letting each cycle repeat 50 times (= 50 * 6 and 50 * 2). It seems to work this way but I wanted to know if there is a more elegant way to get the intended rate (i.e. 300 go trials, 100 stop trials). For example by using python?
      Does that make more sense?

    Thank you for your help!
    Kind regards

  • Hi,

    Is there a reason, you prefer not to do it the way you're doing it right now? It seems like a perfectly fine way to me (maybe you can even use 3 go and 1 nogo trial instead). Of course, you can also do it with some scripting if you wish, but it would boil down to the same thing.


Sign In or Register to comment.