meeg_utils.steps.ASR#

class meeg_utils.steps.ASR(cutoff=20.0, *, picks='eeg', window_length=0.5, max_dims=0.66, calibration='auto')[source]#

Artifact subspace reconstruction: repair high-amplitude bursts in continuous EEG.

Wraps mne_denoise.asr.ASR (Kothe & Jung, 2016; Chang et al., 2020, IEEE Trans Biomed Eng 67:1114). fit finds clean calibration windows in the recording and learns the statistics of clean data; transform slides a window over the data and, where components exceed cutoff standard deviations of the calibration data, reconstructs them from the rest.

Parameters:
  • cutoff (float) – Threshold in standard deviations (default 20, EEGLAB’s clean_rawdata default; Chang et al. 2020 recommend 20-30). Lower values repair more, and remove more brain signal.

  • picks (str) – Channel type to process (default "eeg"). Bad channels are left out: detect them first.

  • window_length (float) – Processing window (s).

  • max_dims (float | int) – Maximum fraction (or number) of dimensions reconstructed per window.

  • calibration ({"auto", "manual"}) – "auto" selects clean calibration windows; "manual" uses all of the data passed to fit (e.g. a clean baseline recording).

asr_#

The fitted model.

Type:

mne_denoise.asr.ASR

qc_#

n_channels, fraction_reconstructed_windows, fraction_reconstructed_samples, max_components_reconstructed and variance_removed_pct (last transform).

Type:

dict

Notes

High-pass filter first (EEGLAB filters at 0.25-0.75 Hz): drifts inflate the calibration statistics. ASR changes the data only where it detects bursts; to mark segments instead, see BadSegments.

Figures (plot()): "reconstruction" (components reconstructed over time) and "psd".

__init__(cutoff=20.0, *, picks='eeg', window_length=0.5, max_dims=0.66, calibration='auto')[source]#

Methods

__init__([cutoff, picks, window_length, ...])

fit(inst[, y, system])

Learn the step's state from the data.

fit_transform(inst[, y, system, copy])

Fit the step on the data and transform the same data.

get_metadata_routing()

Get metadata routing of this object.

get_params([deep])

Get parameters for this estimator.

plot([kind, inst])

Draw quality-control figures.

set_fit_request(*[, inst, system])

Configure whether metadata should be requested to be passed to the fit method.

set_params(**params)

Set the parameters of this estimator.

set_transform_request(*[, copy, inst])

Configure whether metadata should be requested to be passed to the transform method.

transform(inst, *[, copy])

Apply the fitted step to the data.

Attributes

accepts

Data types the step accepts.

adds_annotations

Whether the step may add BAD_ annotations (existing ones are kept).

changes_channels

Whether the step may add, drop or reorder channels.

changes_times

Whether the step may change the time axis (e.g. resampling, cropping).

drops_epochs

Whether the step may drop epochs (e.g. artifact rejection).

plot_kinds

kind -> whether it needs data (inst).

returns

Data type the step returns; None means the same type as its input.

systems

Acquisition systems the step applies to; None means all systems.

accepts: ClassVar[tuple[type, ...]] = (<class 'mne.io.base.BaseRaw'>,)#

Data types the step accepts.

plot_kinds: ClassVar[dict[str, bool]] = {'psd': False, 'reconstruction': False}#

kind -> whether it needs data (inst). Each kind is drawn by a _plot_<kind>(inst, **kwargs) method.

Type:

Figures the object can draw once fitted