Remove TMS pulse artifact
This function removes data between defined time points and replaces data with 0s or the average of a defined period (e.g. a baseline period). The function can run on either continuous or epoched data. Removed time points are stored in EEG.tmscut and can be interpolated using tesa_interpdata.

EEGLAB interface

1. Enter time values for removing data. Values are in ms. Enter the start value followed by the end value. Note that the times are relevant to events, not the epoch. For example, if an event is located at -100 ms in an epoch, running the algorithm with [-10,10] would remove between -110 and -90 ms. Example: -2, 10
2. Replace the removed data with the average of a baseline period. Values are in ms. Enter the start value followed by the end value. If left blank, the data are replaced with 0s. As above, times are relative to events, not the epoch. Example: -500, -100
3. Choose an event from the EEGLAB event structure to replace data around. If left blank, the function will remove data from all events present in the data. Example: 'TMS'

Script

Base function

EEG = tesa_removedata( EEG, cutTimesTMS ); Default use.
EEG = tesa_removedata( EEG, cutTimesTMS, replaceTimes , cutEvent ); Custom input.

Pop function

EEG = pop_tesa_removedata( EEG ); Pop-up window.
EEG = pop_tesa_removedata( EEG, cutTimesTMS ); Default use.
EEG = pop_tesa_removedata( EEG, cutTimesTMS, replaceTimes , cutEvent ); Custom input.

Required inputs

Input
Description
Example
Default
EEG
EEGLAB EEG structure
EEG
-
cutTimesTMS
(Required) Vector with time range for removing TMS artifact in ms. Note that the times are relevant to events, not the epoch.
[-10,10]
-
replaceTimes
(Optional) Vector with time range for calculating average to replace removed data in ms. If not included, data will be replaced with 0s. As above, times are relative to events, not the epoch.
[-500, -100]
[ ]
cutEvent
(Optional) Cell with strings indicating event/s to remove data around. If left empty, tesa_removedata will remove data for all events.
{'TMS'} {'single','paired'}{'1'}
[]

Outputs

Output
Description
EEG
EEGLAB EEG structure

Examples

EEG = pop_tesa_removedata( EEG, [-10,10] ); Replace with 0s
EEG = pop_tesa_removedata( EEG, [-10,10], [-500,-100], {'TMS'} ); Replace with average of defined period in ms around event 'TMS'.
EEG = pop_tesa_removedata( EEG, [-10,10], [], {'TMS'} ); Replace with 0s around event 'TMS'
Last modified 1yr ago