Find TMS pulses
Last updated
Last updated
This function finds TMS pulses by detecting the large TMS artifacts present in the data. The function works by extracting a single channel and finding the time points in which the first derivatives exceed a certain threshold (defined by 'rate'). Paired pulses and repetitive TMS trains can also be detected. The data must be continuous (i.e. not epoched).
For this function to work, the TMS pulse artifacts must be present in the data. So this function is not appropriate for systems using a sample-and-hold circuit to suppress the TMS pulse artifact. This function also works better on higher sampling rates (>5 kHz), where the artifact has been well characterised.
Example of output from TESA find pulse function. Left: Continuous time course of electrode Cz with detected artifacts marked with red dots. Right: Magnified view of left image showing the first four identified artifacts.
1. Select the electrode for finding the TMS pulse artifact.
2. Define a refractory period (i.e. the time it takes for the TMS pulse to recover). If an artifact event is marked multiple time (instead of just once), increase this value.
3. Define the rate of change for detecting the TMS artifact (in uV/ms). If too many non-TMS pulse artifacts are being incorrectly labeled, increase this number. Conversely, if the function is missing TMS pulse artifacts, decrease this number.
4. Label for single TMS pulses. Events inserted in to the EEGLAB structure will be called by this name.
5. Plot identified artifacts. Turn on to plot a summary of the TMS artifacts found in the data.
6. Turn on to search for paired pulses. If this is on, an inter-stimulus interval value must also be given in 7. This will cause the function to search for paired as well as single pulses. A paired pulse is defined as two successive pulses in which the inter-stimulus interval matches those given.
7. Define the inter-stimulus interval which the function will use to label an artifact as single or paired. For example, if you are using a LICI paradigm with an ISI of 100 ms, enter a value of 100 here. The function has a precision of 0.5 ms for determining whether two successive pulses fall within this ISI. If multiple different paired pulse conditions are present in the same file, this can be entered as: 3, 15, 100 etc. Note that the number of paired label inputs in 8 must match the number of ISIs entered.
8. Enter a customised label for the paired pulse test stimulus (i.e. the second stimulus). If left blank, the default is TMSpair. The conditioning pulse (i.e the first pulse) is automatically labeled as 'con'. Note that this label cannot be the same as the single label defined in 4. If multiple ISIs are given, multiple labels corresponding with these ISIs can be given as: SICI, ICF, LICI. Note the number of labels must match the number of ISIs.
9. Turn on to search for trains of repetitive TMS pulses. If this is on, an inter-train interval must be given in 10 and the number of pulses in a train must be given in 11.
10. Define the inter-train interval. This refers to the number of milliseconds between a train of stimulations. For example, if a 10 Hz paradigm was given in which stimulation was applied for 4 seconds (40 pulses) followed by a 26 second rest, the inter-train interval would be 2600.
11. Define the number of pulses in a train. Using the above example, the number of pulses would be 40.
EEG = tesa_findpulse( EEG, elec );
Default use.
EEG = tesa_findpulse( EEG, elec, 'key1', value1... );
Custom input.
EEG = pop_tesa_findpulse( EEG );
Pop up window
EEG = pop_tesa_findpulse( EEG, elec );
Default use.
EEG = pop_tesa_findpulse( EEG, elec, 'key1', value1... );
Custom input.
Input
Description
Example
Default
EEG
EEGLAB EEG structure
EEG
-
elec
String defining electrode to use for finding artifact
'Cz'
-
Key
Input value
Description
Example
Default
'refract'
integer
Integer defines the refractory period (the time for the TMS artefact to recover below the rate of change). Integer is in ms.
2
3
'rate'
integer
Integer defines the rate of change of the TMS artifact in uV/ms.
1e4
1e4
'tmsLabel'
'string'
'String' is a label for the single TMS event.
'Single'
'TMS'
'plots'
'on' or 'off'
Brings up a plot showing the detected peaks. Red = detected
'on'
'on'
'paired'
'yes' or 'no'
Type 'yes' to turn on paired detection
'yes'
'no'
'ISI'
integer
Required if 'paired' is 'yes'. integer is a vector defining interstimulus intervals between conditioning and test pulses. Multiple ISIs can be defined as [3,100,...].
100 (single paired condition); [3,15,100] (multiple paired conditions)
[ ]
'pairLabel'
{'string'}
Required if more than one ISI. {'string'} is a cell array containing string labels for different ISI conditions. Multiple labels can be defined as {'SICI','LICI',...}. The number of labels defined must equal the number of ISI conditions defined.
{'LICI'} (single ISI); {'SICI','ICF','LICI} (multiple ISIs)
{'TMSpair'}
'repetitive'
'yes' or 'no'
Type 'yes' to turn on repetitive detection.
'yes'
'no'
'ITI'
integer
required if 'repetitive' is 'yes'. Integer defines the inter-train interval in ms. For example, if a 10 Hz rTMS condition is used with 4s of stimulation (40 pulses) and 26s of rest, ITI = 2600.
2600
[ ]
'pulseNum'
integer
Required if 'repetitive' is 'yes'. int defines the number of pulses in a train. Using the above example, this would be 40.
40
[ ]
Output
Description
EEG
EEGLAB EEG structure
EEG = tesa_findpulse( EEG, 'Cz' );
default use
EEG = tesa_findpulse( EEG, 'Fz', 'refract', 4, 'rate', 2e5, 'tmsLabel', 'single', 'plots', 'off' );
user defined inputs
EEG = tesa_findpulse( EEG, 'Cz', 'paired', 'yes', 'ISI', [100],'pairLabel', {'LICI'});
paired pulse use
EEG = tesa_findpulse( EEG, 'Cz', 'repetitive', 'yes', 'ITI', 26, 'pulseNum', 40 );
rTMS use