7906
Comment:
|
7402
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
= Tutorial 8: Fixing stimulation delays = | = Tutorial 8: Stimulation delays = |
Line 3: | Line 3: |
The event markers that are saved in the file might not accurate. In most cases, the stimulation triggers saved by the acquisition system indicate when the stimulation computer requested a stimulus to be presented. After this request, the equipment used to deliver the stimulus to the subject (projector, screen, sound card, electric or tactile device) always introduce some delays. Therefore, the stimulus triggers are saved before the instant when the subject actually receives the stimulus. For accurate timing of the brain responses, it is very important to estimate those delays precisly and if possible to account for them in the analysis. This tutorial explains how to correct for the different types of delays in the case of an auditory study, if the output of the soundcard is saved together with the MEG/EEG recordings. A similar approach can be used in visual experiments using a photodiode. |
|
Line 7: | Line 11: |
The delays present in those recordings are documented on this page: [[DatasetAuditory|MEG auditory dataset]]. | The full description of this audoitory dataset is available on this page: [[DatasetIntroduction|Introduction dataset]]. |
Line 9: | Line 13: |
* '''Delay #1''': Between the stim markers (channel UDIO001) and the moment where the sound card plays the sound (channel UADC001). This is mostly due to the software running on the computer (stimulation software, operating system, sound card drivers, sound card electronics). The delay can be measured from the recorded files by comparing the triggers in the two channels: Delay''' between 11.5ms and 12.8ms''' (std = 0.3ms) This delay is '''not constant''', we will need to correct for it. | <<Include(DatasetAuditory, , from="\<\<HTML\(\<!-- START-DELAYS --\>\)\>\>", to="\<\<HTML\(\<!-- STOP-DELAYS --\>\)\>\>")>> |
Line 11: | Line 15: |
* '''Delay #2''': Between when the sound card plays the sound and when the subject receives the sound in the ears. This is the time it takes for the transducer to convert the analog audio signal into a sound, plus the time it takes to the sound to travel through the air tubes from the transducer to the subject's ears. This delay cannot be estimated from the recorded signals: before the acquisition, we placed a sound meter at the extremity of the tubes to record when the sound is delivered. Delay '''between 4.8ms and 5.0ms''' (std = 0.08ms). At a sampling rate of 2400Hz, this delay can be considered '''constant''', we will not compensate for it. * '''Delay #3''': The CTF MEG systems have a constant delay of '''4 samples''' between the MEG/EEG channels and the analog channels (such as the audio signal UADC001), because of an anti-aliasing filtered that is applied to the first and not the second. This translate here to a '''constant delay''' of '''1.7ms'''. * '''Delay #4''': When correcting of delay #1, the process we use to detect the beginning of the triggers on the audio signal (UADC001) sets the trigger in the middle of the ramp between silence and the beep. We "over-compensate" the delay #1 by 1.7ms. This can be considered as '''constant delay '''of about '''-1.7ms'''. * '''Uncorrected delays''': We will correct for the delay #1, and keep the other delays (#2, #3 and #4). After we compensate for delay #1 our MEG signals will have a '''constant delay '''of about 4.9 + 1.7 - 1.7 = '''4.9 ms'''. We decide not to compensate for those delays because they do not introduce any jitter in the responses and they are not going to change anything in the interpretation of the data. |
{{attachment:delays_sketch.gif||height="144",width="710"}} |
Line 31: | Line 29: |
{{http://neuroimage.usc.edu/brainstorm/Tutorials/TutProcesses?action=AttachFile&do=get&target=files1.gif|files1.gif|class="attachment"}} |
. {{http://neuroimage.usc.edu/brainstorm/Tutorials/TutProcesses?action=AttachFile&do=get&target=files1.gif|files1.gif|class="attachment"}} |
Line 36: | Line 33: |
{{http://neuroimage.usc.edu/brainstorm/Tutorials/TutProcesses?action=AttachFile&do=get&target=files2.gif|files2.gif|class="attachment"}} |
. {{http://neuroimage.usc.edu/brainstorm/Tutorials/TutProcesses?action=AttachFile&do=get&target=files2.gif|files2.gif|class="attachment"}} |
Line 39: | Line 35: |
{{http://neuroimage.usc.edu/brainstorm/Tutorials/TutProcesses?action=AttachFile&do=get&target=files3.gif|files3.gif|class="attachment"}} |
. {{http://neuroimage.usc.edu/brainstorm/Tutorials/TutProcesses?action=AttachFile&do=get&target=files3.gif|files3.gif|class="attachment"}} |
Line 43: | Line 38: |
{{http://neuroimage.usc.edu/brainstorm/Tutorials/TutProcesses?action=AttachFile&do=get&target=files4.gif|files4.gif|class="attachment"}} |
. {{http://neuroimage.usc.edu/brainstorm/Tutorials/TutProcesses?action=AttachFile&do=get&target=files4.gif|files4.gif|class="attachment"}} |
Line 60: | Line 54: |
=== Sort analog events into event categories === Typically the analog channel contains events (like a photodiode signal) that do not contain information about which event is occurring. This can be rectified by matching the event marker from the acquisition with the events detected on the analog channel: Run > Events > Combine stim/response ignore ; B_AB ; A ; B substitute ‘B’ with the photodiode event name substitute ‘A’ with the event name of interest == Button responses == Same thing with button responses: re-detect from Stim/UDIO001 You can do similar things with a photodiode in the case of a visual experiment. |
Tutorial 8: Stimulation delays
Authors: Francois Tadel, Elizabeth Bock
The event markers that are saved in the file might not accurate. In most cases, the stimulation triggers saved by the acquisition system indicate when the stimulation computer requested a stimulus to be presented. After this request, the equipment used to deliver the stimulus to the subject (projector, screen, sound card, electric or tactile device) always introduce some delays. Therefore, the stimulus triggers are saved before the instant when the subject actually receives the stimulus.
For accurate timing of the brain responses, it is very important to estimate those delays precisly and if possible to account for them in the analysis. This tutorial explains how to correct for the different types of delays in the case of an auditory study, if the output of the soundcard is saved together with the MEG/EEG recordings. A similar approach can be used in visual experiments using a photodiode.
Contents
Existing delays
The full description of this audoitory dataset is available on this page: Introduction dataset.
Delay #1: Production of the sound.
Between the stim markers (channel UDIO001) and the moment when the sound card plays the sound (channel UADC001). This is mostly due to the software running on the computer (stimulation software, operating system, sound card drivers, sound card electronics). The delay can be measured from the recorded files by comparing the triggers in the two channels: Delay between 11.5ms and 12.8ms (std = 0.3ms) This delay is not constant, we will need to correct for it.Delay #2: Transmission of the sound.
Between when the sound card plays the sound and when the subject receives the sound in the ears. This is the time it takes for the transducer to convert the analog audio signal into a sound, plus the time it takes the sound to travel through the air tubes from the transducer to the subject's ears. This delay cannot be estimated from the recorded signals: before the acquisition, we placed a sound meter at the extremity of the tubes to record when the sound is delivered. Delay between 4.8ms and 5.0ms (std = 0.08ms). At a sampling rate of 2400Hz, this delay can be considered constant, we will not compensate for it.Delay #3: Recording of the signals.
The CTF MEG systems have a constant delay of 4 samples between the MEG/EEG channels and the analog channels (such as the audio signal UADC001), because of an anti-aliasing filter that is applied to the first and not the second. This translate here to a constant delay of 1.7ms.Delay #4: Over-compensation of delay #1.
When correcting of delay #1, the process we use to detect the beginning of the triggers on the audio signal (UADC001) sets the trigger in the middle of the ramp between silence and the beep. We "over-compensate" the delay #1 by 1.7ms. This can be considered as constant delay of about -1.7ms.Uncorrected delays: We will correct for the delay #1, and keep the other delays (#2, #3 and #4). After we compensate for delay #1 our MEG signals will have a constant delay of about 4.9 + 1.7 - 1.7 = 4.9 ms. We decide not to compensate for these delays because they do not introduce any jitter in the responses and they are not going to change anything in the interpretation of the data.
Evaluation of the delay
Right-click on Run01/Link to raw file > Stim > Display time series (stimuls channel, UDIO001) Right-click on Run01/Link to raw file > ADC V > Display time series (audio signal generated, UADC001)
In the Record tab, set the duration of display window to 0.200s. Jump to the third event in the "standard" category.
We can observe that there is a delay of about 13ms between the time where the stimulus trigger is generated by the stimulation computer and the moment where the sound is actually played by the sound card of the stimulation computer (delay #1). This is matching the documentation of the experiment in the first section of this tutorial.
Selecting files to process
First thing to do is to define the files you are going to process. This is done easily by picking files or folders in the database explorer and dropping them in the empty list of the Process1 tab.
- Drag and drop the following nodes in the Process1 list: Right/ERF (recordings), Right (condition), and Subject01 (subject)
- The number in the brackets next to each node represents the number of data files that where found in each of them. The node ERF "contains" only itself (1), Subject01/Right contains ERF and Std files (2), and Subject01 contains 2 conditions x 2 recordings (4).
- The total number of files, ie. the sum of all those values, appears in the title of the panel "Files to process [7]".
- The buttons on the left side allow you to select what type of file you want to process: Recordings, sources, time-frequency, other. Now select the second button "Sources". All the counts are updated and now reflect the number of sources files that are found for each node.
- If you select the third button "Time-frequency", you would see "0" everywhere because there are no time-frequency decompositions in the database yet.
Now clear the list from all the files. You may either right-click on the list (popup menu Clear list), or select all the nodes (holding Shift or Crtl key) and then press the Delete key.
Select both files Left/ERF and Right/ERF in the tree (holding Ctrl key), and put the in Process list. We are going to apply some functions on those two files. You cannot distinguish them after they are dropped in the list, because they are both referred as "ERP". If at some point you need to know what is in the list, just leave you mouse over a node for a few seconds, and a tooltip would give you information about it. Just like in the database explorer.
Correction
Delay #1: We can detect the triggers from the analog audio signal (ADC V/UADC001) rather than using the events already detected by the CTF software from the stim channel (Stim/UDIO001).
Drag and drop Run01 and Run02 to the Process1 box.
Add twice the process "Events > Detect analog triggers". Once with event name="standard_fix" and reference event="standard". Once with event name="deviant_fix" and reference event="deviant". Set the other options as illustrated below:
- Open Run01 (channel ADC V) to evaluate the correction that was performed by this process. If you look at the third trigger in the "standard" category, you can measure a 14.6ms delay between the original event "standard" and the new event "standard_fix".
Open Run01 to re-organize the event categories:
Delete the unused event categories: standard, deviant.
Rename standard_fix and deviant_fix to standard and deviant.
Open Run02 and do the same cleaning operations:
Important note: We compensated for the jittered delays (delay #1), but not for the other ones (delays #2, #3 and #4). There is still a constant 5ms delay between the stimulus triggers ("standard" and "deviant") and the time where the sound actually reaches the subject's ears.
Sort analog events into event categories
Typically the analog channel contains events (like a photodiode signal) that do not contain information about which event is occurring. This can be rectified by matching the event marker from the acquisition with the events detected on the analog channel:
Run > Events > Combine stim/response
ignore ; B_AB ; A ; B
substitute ‘B’ with the photodiode event name
substitute ‘A’ with the event name of interest
Button responses
Same thing with button responses: re-detect from Stim/UDIO001
You can do similar things with a photodiode in the case of a visual experiment.