EEG artifact removal that leaves the decision with you

Blinks, muscle tension and line noise are often larger than the brain signal you want. Removing them is a sequence of decisions, and each one should be visible and reversible.

Updated

An EEG artifact is any recorded signal that does not come from the brain activity under study. Artifacts matter beyond looking messy: a classifier will learn whatever separates the classes, and if participants blink more in one condition, the decoder can end up reading the blinks.

There are three tools, used in this order: drop the electrodes that are not recording properly, separate and remove artifact sources with ICA, and reject the trials that are still contaminated.

Common artifacts and how to spot them

ArtifactLooks likeUsual remedy
Eye blinkLarge slow deflection, strongest frontallyICA
Eye movementBox-shaped shifts, opposite polarity left vs rightICA
Muscle (EMG)Broadband high-frequency bursts, often temporalICA where separable, otherwise trial rejection
Cardiac (ECG)Regular sharp peaks about once a secondICA
Line noiseNarrow peak at 50 or 60 HzNotch filter
Bad electrodeFlat line, railing or constant noiseDrop the channel
MovementLarge irregular excursions across channelsTrial rejection

ICA: separate, then decide

Independent Component Analysis unmixes the recording into statistically independent sources. Blinks, muscle and heartbeat tend to concentrate in their own components, so removing those components and reconstructing the signal removes the artifact while keeping the rest.

BCILattice's ICA Review step runs FastICA (scikit-learn) or Picard (MNE) and suggests artifact components using measures such as excess kurtosis (sharp transients like blinks and QRS complexes), skew, and the 1/f slope of the component spectrum (cortical background sits near −1, and a flat or positive slope points to muscle). Each suggestion carries its reason. Nothing is rejected until you label it and apply. Rejection then writes a new ICA-cleaned stage and records which components were removed.

Bad channels first

Screening channels before ICA is standard practice, because a dead or railing channel distorts the decomposition. Channel Quality scores every channel with Variance + Noise (the default), Kurtosis + Variance, or Peak-to-Peak Amplitude, flags channels whose score passes a sensitivity threshold, and always force-flags a flat-line channel. You confirm the drops.

It refuses normalised input on purpose: bad-channel detection is based on amplitude and variance, and normalisation removes exactly the scale those measures read.

Automatic labelling, if you want it

The free extension shelf adds the established automatic tools as blocks: MNE-ICALabel for automatic ICA component classification (brain, muscle, eye, heart, line noise), Autoreject for epoch rejection with thresholds fitted by cross-validation, PyPREP for the PREP pipeline, and MEEGkit for ZapLine, DSS and ASR. They are useful at scale. Check what they decide on a few recordings before trusting them across a cohort.

Trial rejection

After cleaning, some trials are still unusable. Epoching offers automatic robust rejection, which drops epochs whose peak-to-peak amplitude exceeds the median plus k × MAD across trials (k defaults to 3.5), or a fixed peak-to-peak threshold in the signal's native units, suggested from your data. Rejection is off by default, and when it is on you see which trials were dropped and why.

Questions

How do I remove eye blinks from EEG?

Run ICA, identify the components that capture the blink (large, frontal, highly kurtotic), remove them and reconstruct the signal. This keeps the brain activity in the same time windows rather than discarding them.

What is ICA in EEG?

Independent Component Analysis is a blind source separation method that unmixes multichannel EEG into statistically independent components. Artifacts such as blinks and heartbeat tend to separate into their own components, which can then be removed.

FastICA or Picard?

Both estimate the same kind of decomposition. Picard usually converges faster and more reliably on real EEG, and FastICA is the classic, widely available choice. BCILattice offers both.

Should I reject trials or clean them?

Clean what can be separated, such as blinks and heartbeat with ICA, and reject what cannot, such as large movement artifacts. Rejecting too much loses statistical power; cleaning too aggressively removes brain signal.

Can artifacts inflate BCI accuracy?

Yes. If an artifact differs between classes, for example more blinks in one condition, a classifier can learn it instead of the brain signal and report accuracy that has nothing to do with the brain.

Read the reference

Related

Run a study end to end, on your own machine

The free plan covers two studies, the full analysis suite, and 118 of the 119 ML blocks.