Median filter
This function applies a 1-dimensional median filter of nth-order to remove artifacts such as spikes and muscle artifacts. Note that spike artifacts can be selected using the gui option in tesa_findpulsepeak.

EEGLAB user interface

1. Enter the time window to be filtered around the event (in ms). Note that t1 must be either 0 or negative and t2 must be positive. Example: -10, 20
2. Enter the order of the filter. The filter order determines the number of samples considered either side of the data point when calculating the median value. Example: 99.
3. Select the event to be filtered around, for example a spike event selected using tesa_findpulsepeak or the TMS pulse.

Scripts

Base function

EEG = tesa_filtmedian( EEG, timeWin, filtOrd, label ); Default use.

Pop function

EEG = pop_tesa_filtmedian( EEG ); Pop up window
EEG = pop_tesa_filtmedian( EEG, timeWin, filtOrd, label ); Custom inputs

Required inputs

Input
Description
Example
Default
EEG
EEGLAB EEG structure
EEG
-
timeWin
Vector with time range for applying median filter in ms. Note that t1 must be 0 or negative and t2 positive
[-20,30]
-
filtOrd
Integer indicating filter order. The filter order determines the number of samples considered either side of the data point when calculating the median value.
99
-
label
String indicating which event type to filter around
'TMS'
-

Outputs

Output
Description
EEG
EEGLAB EEG structure

Examples

EEG = tesa_filtmedian( EEG, [-2,2], 3, 'spike' ); Apply a 3rd order median filter to remove small spike artifacts
Last modified 2yr ago