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:
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+3RUN:
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
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