detect_artifacts

detect_artifacts(data, Fs, varargin)

DETECT_ARTIFACTS Detect artifacts in time-domain EEG by iteratively removing high-z segments in HF and broadband channels

Usage:

artifacts = detect_artifacts(data, Fs, ‘Name’, Value, …)

Inputs:

data : 1xN double - time series data – required Fs : double - sampling frequency in Hz – required

Name-Value Pairs:

‘isexcluded’ : 1xN logical - time points excluded from threshold updating (default: all false) ‘crit_units’ : char - ‘std’ for iterative std or ‘MAD’ for a strict MAD threshold (default: ‘std’) ‘hf_crit’ : double - high-frequency criterion in stds/MADs above the mean (default: 4) ‘hf_pass’ : double - high-pass cutoff for the HF channel in Hz (default: 35) ‘bb_crit’ : double - broadband criterion in stds/MADs above the mean (default: 4) ‘bb_pass’ : double - high-pass cutoff for the broadband channel in Hz (default: 2) ‘smooth_duration’ : double - smoothing window in seconds (default: 2) ‘detrend_duration’ : double - detrending window in seconds (default: 300) ‘buffer_duration’ : double - mask buffer around detected artifacts in seconds (default: 0) ‘verbose’ : logical - verbose output (default: false) ‘histogram_plot’ : logical - plot histograms for debugging (default: false) ‘return_filts_only’ : logical - return the three digitalFilter objects and exit (default: false) ‘hpFilt_high’ : digitalFilter - pre-built HF high-pass filter (default: []) ‘hpFilt_broad’ : digitalFilter - pre-built broadband high-pass filter (default: [])

Outputs:

artifacts : 1xT logical - times flagged as artifacts (logical OR of HF and broadband artifacts)

Notes

When return_filts_only is true, the output is a 1x3 cell of digitalFilter objects in order {hpFilt_high, hpFilt_broad, detrend_filt}. Detrend is applied locally inside detrend_duration-length windows.

See also: multitaper_spectrogram_mex, designfilt, filtfilt

∿∿∿ Prerau Laboratory MATLAB Codebase · sleepEEG.org ∿∿∿