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!

Regards,

Kate Riggall


Comments

  • 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?

    PREPARE:

    #Create canvas
    Mask2_canvas=canvas()
    #Get variable from loop
    Mask2_canvas=self.get(Mask2)
    # Determine the absolute path
    path = exp.pool["Mask2"]
    # Function interface
    Mask2_canvas.image(path)
    # 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
    my_mouse.flush()
    
    
    #create lure variable
    lure=self.get("lure")
    #set trigger code
    trigger_code=lure+3
    

    RUN:

    #show canvas
    Mask2_canvas.show()
    
    #send trigger
    exp.serial_port.write(chr(trigger_code))
    
    #check for mouse response
    resp, position, time = my_mouse.get_click(timeout=700)
    
    #wait until next image
    clock.sleep(700)
    

    Kind regards,

    Kate Riggall

  • Hi Kate,

    I agree that inline_script is to be preferred. Your code is a good start, but still needs some more tweaking to make it work. How far did you get in the mean time? DO you still need help?


    Eduard

    Buy Me A Coffee

  • Hi Eduard,

    I'm just coming back to this after travelling for a conference, so I haven't gotten any further, I'll be working on it today and this week so if you have any pointers that would be much appreciated.

    Kind regards,

    Kate Riggall

  • Hi Kate,

    I can help, but can you please point me towards where exactly I can give you pointers? :)

    Eduard

    Buy Me A Coffee

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games