Phasic← Overview

ASR — Artifact Subspace Reconstruction

Panel:      Tools ▸ ASR
Requires:   (no feature flag)
Applies to: scalp EEG channels only

ASR removes high-amplitude transient artifacts — movement, muscle bursts, electrode pops — without removing the segments that contain them. Rather than rejecting bad stretches, it reconstructs the corrupted part of the signal from the part that is still clean.

It follows the method of Mullen et al. (2015), as implemented in EEGLAB’s clean_rawdata.

How it works

Calibration. ASR first learns what clean data looks like in this recording, building a covariance model from a reference stretch. This defines the normal spatial structure of the signal — how channels usually co-vary.

Processing. It then slides across the recording. In any window that bursts into a spatially abnormal subspace — a direction the calibration says should not carry this much energy — that subspace is replaced by its best linear estimate from the retained, clean subspace. Windows that look normal pass through untouched.

The effect is that an artifact is removed while the underlying brain activity recorded at the same moment is preserved as far as the clean subspace allows.

Scoped to scalp EEG

ASR acts only on scalp EEG channels. Other channels pass through completely untouched.

This is not a simplification — it is required for correctness. ASR learns a covariance model of normal activity, and an ECG channel’s QRS complexes are large, regular and entirely normal for that channel. Including one would teach the model that such excursions are ordinary, and it would then fail to clean genuine EEG artifacts of comparable amplitude.

A recording with no scalp EEG has nothing for ASR to clean.

Where it sits

ASR is applied below everything else: it substitutes a cleaned signal for the raw one, and every later stage sees the cleaned version without needing to know cleaning happened.

It is transparent to the channel set — same count, order and names.

Live and offline

ASR runs on both a recorded file and a live stream. The calibration model is learned once and then applied continuously, so a live stream is cleaned as it arrives.

The streaming implementation maintains continuity across window boundaries; chunked processing gives the same result as processing the signal in one pass, and this is covered by the test suite.

Things to know

Calibration can fail. If no sufficiently clean reference stretch can be found, ASR produces no model and no cleaning is applied.

ASR is applied only where lengths match. If its output length does not match the source for a channel, that channel’s raw signal passes through unchanged rather than being replaced with something of the wrong length. This is silent — if you expect cleaning and see none, this is a candidate explanation.

Aggressive settings remove real signal. ASR cannot distinguish an artifact from unusual but genuine activity beyond what the covariance model captures. A threshold tight enough to remove every artifact will also attenuate real high-amplitude events.