Timing Tests for EEG - Stimulus offset


Author
Message
Andrew Papale
Andrew Papale
Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)
Group: Forum Members
Posts: 62, Visits: 230
Inquisit Community,

We are using Inquisit 6 for an EEG task requiring millisecond precision.  To test the timing of stimulus display, I have hooked up a photodiode to a virtual oscilloscope and tested the timing of stimulus onset relative to trigger times and stimulus onset relative to stimulus offset.  The primary concern I have is that Inquisit 6 seems to be stopping the display of stimuli before the requested timing in the code.  I have compared our oscilloscope measurements with the data audit times and they are inconsistent.  I have repeated the test on two different graphics cards and observed the same problem (though on the Dell Integrated graphics, the offset was 30ms and on the NVIDIA graphics card it was 20ms before the scheduled offset).  Below are two screenshots from the virtual oscilloscope.  On the left, I have requested a white square be on the screen for 100ms, but observed it switching to a black square after 79ms.  On the right, I have requested a white square be on the screen for 1000ms, and observe it switching to a black square after 980ms.  This is with the NVIDIA graphics card, Windows 10, and Inquisit is running as a realtime process.


The code to do this is very straightforward and I don't think this is a coding error on my part, but feel free to correct any errors.  The relevant code is just:

/ stimulustimes = [0 = white_square, trigger, other stimuli;
             100 = black_square, other stimuli;
             ]. // flash white square for 100ms, send trigger to port COM4 when white square appears


Any help in understanding and/or fixing this behavior would be appreciated.

On the plus side, I will say I have achieved precision with the trigger and stimulus onset on the order of +/- 500 microseconds, which is quite impressive.

Sincerely,
Andrew Papale
University of Pittsburgh
USA
Andrew Papale
Andrew Papale
Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)
Group: Forum Members
Posts: 62, Visits: 230
Andrew Papale - 1/26/2024
Inquisit Community,

We are using Inquisit 6 for an EEG task requiring millisecond precision.  To test the timing of stimulus display, I have hooked up a photodiode to a virtual oscilloscope and tested the timing of stimulus onset relative to trigger times and stimulus onset relative to stimulus offset.  The primary concern I have is that Inquisit 6 seems to be stopping the display of stimuli before the requested timing in the code.  I have compared our oscilloscope measurements with the data audit times and they are inconsistent.  I have repeated the test on two different graphics cards and observed the same problem (though on the Dell Integrated graphics, the offset was 30ms and on the NVIDIA graphics card it was 20ms before the scheduled offset).  Below are two screenshots from the virtual oscilloscope.  On the left, I have requested a white square be on the screen for 100ms, but observed it switching to a black square after 79ms.  On the right, I have requested a white square be on the screen for 1000ms, and observe it switching to a black square after 980ms.  This is with the NVIDIA graphics card, Windows 10, and Inquisit is running as a realtime process.


The code to do this is very straightforward and I don't think this is a coding error on my part, but feel free to correct any errors.  The relevant code is just:

/ stimulustimes = [0 = white_square, trigger, other stimuli;
             100 = black_square, other stimuli;
             ]. // flash white square for 100ms, send trigger to port COM4 when white square appears


Any help in understanding and/or fixing this behavior would be appreciated.

On the plus side, I will say I have achieved precision with the trigger and stimulus onset on the order of +/- 500 microseconds, which is quite impressive.

Sincerely,
Andrew Papale
University of Pittsburgh
USA

Some additional details about the figures.  The red trace (CH0) is the photodiode.  The oscilloscope is set to trigger on the photodiode.  The vertical dashed lines measure the length of the photodiode onset (when the white square is on the screen).  The difference in the vertical dashed lines is displayed above in the "delta" in ms.  The orange trace (CH1) is the trigger from Inquisit to our EEG system and can be ignored for these purposes.  Thanks

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 102K
Andrew Papale - 1/26/2024
Andrew Papale - 1/26/2024
Inquisit Community,

We are using Inquisit 6 for an EEG task requiring millisecond precision.  To test the timing of stimulus display, I have hooked up a photodiode to a virtual oscilloscope and tested the timing of stimulus onset relative to trigger times and stimulus onset relative to stimulus offset.  The primary concern I have is that Inquisit 6 seems to be stopping the display of stimuli before the requested timing in the code.  I have compared our oscilloscope measurements with the data audit times and they are inconsistent.  I have repeated the test on two different graphics cards and observed the same problem (though on the Dell Integrated graphics, the offset was 30ms and on the NVIDIA graphics card it was 20ms before the scheduled offset).  Below are two screenshots from the virtual oscilloscope.  On the left, I have requested a white square be on the screen for 100ms, but observed it switching to a black square after 79ms.  On the right, I have requested a white square be on the screen for 1000ms, and observe it switching to a black square after 980ms.  This is with the NVIDIA graphics card, Windows 10, and Inquisit is running as a realtime process.


The code to do this is very straightforward and I don't think this is a coding error on my part, but feel free to correct any errors.  The relevant code is just:

/ stimulustimes = [0 = white_square, trigger, other stimuli;
             100 = black_square, other stimuli;
             ]. // flash white square for 100ms, send trigger to port COM4 when white square appears


Any help in understanding and/or fixing this behavior would be appreciated.

On the plus side, I will say I have achieved precision with the trigger and stimulus onset on the order of +/- 500 microseconds, which is quite impressive.

Sincerely,
Andrew Papale
University of Pittsburgh
USA

Some additional details about the figures.  The red trace (CH0) is the photodiode.  The oscilloscope is set to trigger on the photodiode.  The vertical dashed lines measure the length of the photodiode onset (when the white square is on the screen).  The difference in the vertical dashed lines is displayed above in the "delta" in ms.  The orange trace (CH1) is the trigger from Inquisit to our EEG system and can be ignored for these purposes.  Thanks

If your trial doesn't have a /pretrialpause, it's likely that Inquisit has to delay the onset of the 1st stimulus because it has to some time for the start of the next display refresh cycle, thereby shortening the effective on-screen duration of the stimulus. Graphics card drivers with varying quality can also cause delays and/or frame slippage. (Just because the hardware has been instructed to do something at a specific time unfortunately doesn't always mean that the hardware *will* do said thing at that specific time.)

To minimize timing issues:
(1) Use /pretrialpause and measure again.
(2) If onset delays persist, shift /stimulustimes forward by one or two refresh cycle durations. and measure again.

Also, graphics card performance isn't the only factor at play here. The actual duration depends on a host of other physical characteristics of the respective display, cf. Plant, Hammond & Turner (Behavior Research Methods, 2004), Wiens et al. (Psychological Science, 2004), Plant & Turner (Behavior Research Methods, 2009), Elze & Tanner (Medical Physics, 2009), https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0012792 and many more.

Edited 8 Months Ago by Dave
Andrew Papale
Andrew Papale
Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)
Group: Forum Members
Posts: 62, Visits: 230
Dave - 1/26/2024
Andrew Papale - 1/26/2024
Andrew Papale - 1/26/2024
Inquisit Community,

We are using Inquisit 6 for an EEG task requiring millisecond precision.  To test the timing of stimulus display, I have hooked up a photodiode to a virtual oscilloscope and tested the timing of stimulus onset relative to trigger times and stimulus onset relative to stimulus offset.  The primary concern I have is that Inquisit 6 seems to be stopping the display of stimuli before the requested timing in the code.  I have compared our oscilloscope measurements with the data audit times and they are inconsistent.  I have repeated the test on two different graphics cards and observed the same problem (though on the Dell Integrated graphics, the offset was 30ms and on the NVIDIA graphics card it was 20ms before the scheduled offset).  Below are two screenshots from the virtual oscilloscope.  On the left, I have requested a white square be on the screen for 100ms, but observed it switching to a black square after 79ms.  On the right, I have requested a white square be on the screen for 1000ms, and observe it switching to a black square after 980ms.  This is with the NVIDIA graphics card, Windows 10, and Inquisit is running as a realtime process.