Howdy, Stranger!

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

Supported by

Significant timing delays in triggered looped task

Hello all,

I am attempting to re-implement a task I was given in E-Prime format into opensesame to allow me to send triggers to my EEG setup. Unfortunately the timing of the image display, even in the untriggered practice loop, is significantly slower than the duration I entered into the GUI. The timing of the first two images seem okay, but the next three are very slow. Some of the delay, but not all, seems to dissappear if I remove the mouse response object, but I need this to be in there.

I am using the latest OpenSesame release (3.2.8) and a 64 bit Windows 10 operating system. I am using the Expyriment back end - I tried switching to legacy after reading forum posts but it didn't help.

Any ideas much appreciated!


Kate Riggall


  • Hi Kate,

    It is difficult to know exactly what you mean by timing, but it seems like they are presented for a longer duration than you intended; correct me if I'm wrong. Have you measured this?

    Looking at your experiment, I'd hazard a guess that your response object is indeed the issue. To use the practice loop, here is what's happening at the moment:

    • A target image is presented for 313 ms (if your screen refresh rate is 60 Hz, in reality this will be 317 ms. Keep this in mind, also for the subsequent stimulus durations).
    • Then, a mask is presented for 125 ms.
    • Followed by a cue stimulus for 63 ms; during which no response can be made.
    • The important bit is that next, the response object is 'activated'. However, visually nothing changes. Given the timeout-duration, if no response is made, the cue will be presented for 63 + 650 milliseconds, plus refresh rate deviation. This might be the cause of your perceived timing issues.

    I can see why you'd use this structure to send onset triggers at relevant moments. You could recheck your stimulus durations, order, and time-outs. Co-routines might work here as well. Alternatively, given the relative simplicity of your stimuli, you could use an inline code to present the stimulus with a while-loop that checks for A) a timer, to send your trigger when intended, and B) a keyboard/mouse response.

    As a side note: last year we ran a simple test with a photo-diode. In our experience, the PsychoPy backend produced the smallest and most consistent timing errors.

  • Hi Cesco, thankyou for your response, that's very helpful!

    I was referring to the image durations, yes, and those in turn were throwing off the timing of my triggers. I did measure this with both the image times in the opensesame output and the trigger times in my EEG recording.

    I understand now regarding the image durations. From what you are saying, it seems that what I should do is set the canvas duration to 1 second (=6ms with refresh rate?) and then have an inline script sending a trigger (another few ms?), and then have a mouse response object with a duration of however long I want the image to remain on the screen. Does that sound right?

    And am I correct in thinking that if I wanted the mouse response to last over two or 3 images, I'd have to create a separate mouse response object for each image?

    It does sound like inline code might be the answer, but while I'm familiar with basic python functions and EEG processing in python I'm completely new to this particular usage. From reading the forums and documentation, I've come up with this - is it anything close to what I would need? Is there a tutorial you could suggest to help me out? I haven't used a while loop because I don't want the image to go away when the mouse is clicked, and I haven't used a timer because I want the trigger to be sent as soon as the image is displayed - is that right?


    #Create canvas
    #Get variable from loop
    # Determine the absolute path
    path = exp.pool["Mask2"]
    # Function interface
    # Element interface
    Mask2_canvas['my_image'] = Image(path, scale=2.5)
    #import mouse response function
    from openexp.mouse import mouse
    #create response object
    my_mouse = mouse()
    #flush pending inputs
    #create lure variable
    #set trigger code


    #show canvas
    #send trigger
    #check for mouse response
    resp, position, time = my_mouse.get_click(timeout=700)
    #wait until next image

    Kind regards,

    Kate Riggall

Sign In or Register to comment.