Artifact removal, three ways
Prevent, reject, or model. Regression against EOG, independent component analysis, and artifact subspace reconstruction, with the rule for when each is honest.
On this page12 min
The bestiary taught you to recognize blinks, muscle, heartbeat, and pops. This page is what to do about them. There are three honest strategies, in order of preference: prevent them at the source, reject the stretches that contain them, or model them and subtract the model. And one dishonest one, which is to filterFilter An operation that passes some frequencies and attenuates others; every filter also delays or distorts the timing of what it passes. Related: High-pass filterHigh-pass filter Removes slow drifts and DC offsets, passing everything above a cutoff; set it too high and you erase slow brain activity. , Low-pass filterLow-pass filter Removes fast content above a cutoff; the anti-alias filter is one, and so is the smoothing you apply to a noisy trace. , Notch filterNotch filter A very narrow filter that removes one frequency, usually 60 Hz mains hum; it also rings and distorts nearby content, so fix the hum at the source first. , Phase distortionPhase distortion Different frequencies being delayed by different amounts, which smears and shifts waveforms such as an ERP peak. . Glossary entry aggressively and hope. Let’s go through the three.
Prevent
Everything in the bestiary’s “at the source” notes. A fixation cross. Blink breaks between trials. A relaxed jaw. A cool room. Fresh paste and a settled electrodeElectrode The conductor that turns ion currents in tissue into electron currents in a wire; its chemistry and contact quality set the noise you live with. Related: Silver/silver-chloride (Ag/AgCl)Silver/silver-chloride (Ag/AgCl) The standard electrode material for biopotentials, because its chemistry produces a stable, low-noise, low-drift interface with salty gel. , Electrode impedanceElectrode impedance How hard it is to push current through the skin-electrode contact, typically 5 to 50 kilohms with gel and megohms dry, higher at low frequencies. , Half-cell potentialHalf-cell potential The DC voltage that appears wherever a metal meets an electrolyte; two electrodes with different half-cell potentials produce an offset that can swamp the signal. . Glossary entry. A short recording. Every minute spent here saves an hour of processing and produces data that need no apology. The best labs are the ones whose raw data look clean.
Reject
For epoched experiments, discard trials whose amplitude exceeds a threshold (say, 100 µV peak-to-peak on any channel), or whose variance is many times the median, or that a human marked. Report how many were discarded and why. The rules must be fixed before you look at the results, or you will find yourself discarding the trials that disagree with your hypothesis. Rejection is honest exactly when it is blind.
For continuous data, mark bad segments and exclude them from analysis. MNEMNE-Python The standard open-source Python library for EEG and MEG analysis: filtering, epoching, ICA, topographies, source localization. Related: Independent component analysis (ICA)Independent component analysis (ICA) A method that unmixes multichannel data into statistically independent sources, so blinks and heartbeat can be identified and removed. . Glossary entry’s annotations do this.
Model and subtract
Regression. If you have an EOGElectrooculography (EOG) Recording eye position from the standing voltage across the eyeball, which moves with the eyes; also the main source of blink artifacts in EEG. Related: Blink artifactBlink artifact The large, slow deflection an eye blink produces in frontal channels, often ten times the size of the brain signal. , Electroencephalography (EEG)Electroencephalography (EEG) Recording the brain's electrical activity from electrodes on the scalp, a few tens of microvolts of blurred, summed cortical activity. . Glossary entry channel recording the eyes directly, the blink’s contribution to each EEGElectroencephalography (EEG) Recording the brain's electrical activity from electrodes on the scalp, a few tens of microvolts of blurred, summed cortical activity. Related: Electrocorticography (ECoG)Electrocorticography (ECoG) Recording from electrodes placed on the surface of the brain under the skull, usually during epilepsy surgery evaluation; cleaner and sharper than EEG. , Magnetoencephalography (MEG)Magnetoencephalography (MEG) Recording the tiny magnetic fields produced by cortical currents with superconducting sensors in a shielded room; less blurred by the skull than EEG, and far more expensive. , Volume conductionVolume conduction The spreading of currents from a source through the conductive tissues of the head, which is why one source shows up on many electrodes and why scalp EEG is blurry. , Microvolt (µV)Microvolt (µV) One millionth of a volt. Scalp EEG is tens of microvolts; a AA battery is 1.5 million of them. . Glossary entry channel is roughly a fixed fraction of the EOGElectrooculography (EOG) Recording eye position from the standing voltage across the eyeball, which moves with the eyes; also the main source of blink artifacts in EEG. Related: Blink artifactBlink artifact The large, slow deflection an eye blink produces in frontal channels, often ten times the size of the brain signal. , Electroencephalography (EEG)Electroencephalography (EEG) Recording the brain's electrical activity from electrodes on the scalp, a few tens of microvolts of blurred, summed cortical activity. . Glossary entry signal. Estimate the fraction by regression and subtract. Simple, fast, and it also removes any real brain activity that correlates with the EOGElectrooculography (EOG) Recording eye position from the standing voltage across the eyeball, which moves with the eyes; also the main source of blink artifacts in EEG. Related: Blink artifactBlink artifact The large, slow deflection an eye blink produces in frontal channels, often ten times the size of the brain signal. , Electroencephalography (EEG)Electroencephalography (EEG) Recording the brain's electrical activity from electrodes on the scalp, a few tens of microvolts of blurred, summed cortical activity. . Glossary entry channel, which is a small but real cost.
Independent component analysis. ICAIndependent component analysis (ICA) A method that unmixes multichannel data into statistically independent sources, so blinks and heartbeat can be identified and removed. Related: ArtifactArtifact Anything in the recording that did not come from the brain: blinks, muscle, heartbeat, movement, sweat, mains hum, electrode pops.. Glossary entry assumes the channels are mixtures of a set of independent sources and finds an unmixing that makes the outputs as statistically independent as possible. Blinks, heartbeat, and steady muscle come out as their own components with characteristic scalp maps: a blink component is frontal and symmetric; a heartbeat component is broad and its time course is a regular spikeSpike Shorthand for an action potential as seen by an electrode, a brief blip about a millisecond wide. Related: Action potentialAction potential The brief, all-or-nothing voltage spike a neuron fires, about a millisecond long and about 100 millivolts tall across its membrane. , Spike sortingSpike sorting Deciding which spikes on an electrode came from which neuron, by clustering their waveform shapes. , Extracellular recordingExtracellular recording Recording with an electrode near neurons rather than inside one; you see small, fast blips from nearby cells rather than the full membrane swing. . Glossary entry. You look at each component’s map and time course, decide which are artifactArtifact Anything in the recording that did not come from the brain: blinks, muscle, heartbeat, movement, sweat, mains hum, electrode pops. Related: Blink artifactBlink artifact The large, slow deflection an eye blink produces in frontal channels, often ten times the size of the brain signal. , Independent component analysis (ICA)Independent component analysis (ICA) A method that unmixes multichannel data into statistically independent sources, so blinks and heartbeat can be identified and removed. , Artifact subspace reconstruction (ASR)Artifact subspace reconstruction (ASR) An automatic method that detects short high-variance bursts and reconstructs them from clean data; common in real-time pipelines. . Glossary entry, zero them, and remix. Powerful, standard, and it requires judgment. Never exclude a component you have not looked at. Fit ICAIndependent component analysis (ICA) A method that unmixes multichannel data into statistically independent sources, so blinks and heartbeat can be identified and removed. Related: ArtifactArtifact Anything in the recording that did not come from the brain: blinks, muscle, heartbeat, movement, sweat, mains hum, electrode pops. . Glossary entry on data high-passed at about 1 Hz; drift confuses it.
ArtifactArtifact Anything in the recording that did not come from the brain: blinks, muscle, heartbeat, movement, sweat, mains hum, electrode pops. Related: Blink artifactBlink artifact The large, slow deflection an eye blink produces in frontal channels, often ten times the size of the brain signal. , Independent component analysis (ICA)Independent component analysis (ICA) A method that unmixes multichannel data into statistically independent sources, so blinks and heartbeat can be identified and removed. , Artifact subspace reconstruction (ASR)Artifact subspace reconstruction (ASR) An automatic method that detects short high-variance bursts and reconstructs them from clean data; common in real-time pipelines. . Glossary entry subspace reconstruction. ASRArtifact subspace reconstruction (ASR) An automatic method that detects short high-variance bursts and reconstructs them from clean data; common in real-time pipelines. Related: ArtifactArtifact Anything in the recording that did not come from the brain: blinks, muscle, heartbeat, movement, sweat, mains hum, electrode pops.. Glossary entry learns what clean data look like from a calibrationCalibration The session at the start of BCI use in which the decoder is trained on this person, today, because brains and electrodes drift. Related: Transfer learningTransfer learning Using data from other people or other days to shorten calibration for a new user. . Glossary entry stretch, then slides a window through the recording, detects bursts whose variance is far above clean, and reconstructs those windows from the directions that were clean. It runs in real time, which ICAIndependent component analysis (ICA) A method that unmixes multichannel data into statistically independent sources, so blinks and heartbeat can be identified and removed. Related: ArtifactArtifact Anything in the recording that did not come from the brain: blinks, muscle, heartbeat, movement, sweat, mains hum, electrode pops. . Glossary entry cannot, so it is common in BCIBrain-computer interface (BCI) A system that turns measured brain activity into control of something outside the body, from a cursor to a wheelchair to a speech synthesizer. Related: DecoderDecoder The algorithm that maps neural signals to intended actions, such as a classifier or a Kalman filter. , Closed loopClosed loop A system in which the output feeds back to influence the input, such as a user adjusting their brain activity while watching the cursor it controls. . Glossary entry pipelines. Its parameter (how far above clean counts as a burst) is a dial between under- and over-cleaning.
After ICA you remove three components: a blink, a heartbeat, and one whose scalp map looks like alpha over the back of the head. What have you done?
Removed the alpha rhythmAlpha rhythm A roughly 8 to 12 Hz oscillation over the back of the head that appears when the eyes close and fades when they open. Related: Beta rhythmBeta rhythm Roughly 13 to 30 Hz activity, prominent over motor areas and associated with active concentration or holding still. , Theta rhythmTheta rhythm Roughly 4 to 8 Hz activity, prominent in drowsiness, some memory tasks, and strongly in the rodent hippocampus. , Thalamocortical loopThalamocortical loop The two-way circuit between the thalamus and the cortex whose rhythmic activity produces alpha, sleep spindles, and other EEG rhythms. , Sensorimotor rhythm (mu)Sensorimotor rhythm (mu) An 8 to 13 Hz rhythm over motor cortex that weakens when you move, or imagine moving, the corresponding body part. . Glossary entry. That third component was brain. ICAIndependent component analysis (ICA) A method that unmixes multichannel data into statistically independent sources, so blinks and heartbeat can be identified and removed. Related: ArtifactArtifact Anything in the recording that did not come from the brain: blinks, muscle, heartbeat, movement, sweat, mains hum, electrode pops. . Glossary entry does not know what you want; it separates whatever is independent, and alpha, being a strong independent rhythm, gets its own component. This is why you look at every component’s map and time course before excluding it, and why the number of excluded components in a good analysis is small and reported.
The dishonest option
Band-pass hard, notchNotch filter A very narrow filter that removes one frequency, usually 60 Hz mains hum; it also rings and distorts nearby content, so fix the hum at the source first. Related: FilterFilter An operation that passes some frequencies and attenuates others; every filter also delays or distorts the timing of what it passes. , Common-mode signalCommon-mode signal A voltage that appears equally on both inputs of a differential amplifier, such as 60 Hz hum picked up by the whole body. . Glossary entry, and call it clean. Muscle overlaps beta and gamma; blinks overlap delta and theta; a notchNotch filter A very narrow filter that removes one frequency, usually 60 Hz mains hum; it also rings and distorts nearby content, so fix the hum at the source first. Related: FilterFilter An operation that passes some frequencies and attenuates others; every filter also delays or distorts the timing of what it passes. , Common-mode signalCommon-mode signal A voltage that appears equally on both inputs of a differential amplifier, such as 60 Hz hum picked up by the whole body. . Glossary entry rings. Filtering removes brain activity along with artifactArtifact Anything in the recording that did not come from the brain: blinks, muscle, heartbeat, movement, sweat, mains hum, electrode pops. Related: Blink artifactBlink artifact The large, slow deflection an eye blink produces in frontal channels, often ten times the size of the brain signal. , Independent component analysis (ICA)Independent component analysis (ICA) A method that unmixes multichannel data into statistically independent sources, so blinks and heartbeat can be identified and removed. , Artifact subspace reconstruction (ASR)Artifact subspace reconstruction (ASR) An automatic method that detects short high-variance bursts and reconstructs them from clean data; common in real-time pipelines. . Glossary entry and leaves whatever is in the passband, then hides the evidence. Filtering is for out-of-band noise. ArtifactsArtifact Anything in the recording that did not come from the brain: blinks, muscle, heartbeat, movement, sweat, mains hum, electrode pops. Related: Blink artifactBlink artifact The large, slow deflection an eye blink produces in frontal channels, often ten times the size of the brain signal. , Independent component analysis (ICA)Independent component analysis (ICA) A method that unmixes multichannel data into statistically independent sources, so blinks and heartbeat can be identified and removed. , Artifact subspace reconstruction (ASR)Artifact subspace reconstruction (ASR) An automatic method that detects short high-variance bursts and reconstructs them from clean data; common in real-time pipelines. . Glossary entry are in-band, which is what makes them artifactsArtifact Anything in the recording that did not come from the brain: blinks, muscle, heartbeat, movement, sweat, mains hum, electrode pops. Related: Blink artifactBlink artifact The large, slow deflection an eye blink produces in frontal channels, often ten times the size of the brain signal. , Independent component analysis (ICA)Independent component analysis (ICA) A method that unmixes multichannel data into statistically independent sources, so blinks and heartbeat can be identified and removed. , Artifact subspace reconstruction (ASR)Artifact subspace reconstruction (ASR) An automatic method that detects short high-variance bursts and reconstructs them from clean data; common in real-time pipelines. . Glossary entry.
Which to use
Prevent, always. Then, for an ERPEvent-related potential (ERP) The small, stereotyped voltage waveform the brain produces in response to an event, invisible in a single trial and revealed by averaging many. Related: P300P300 A positive bump about 300 milliseconds after a rare or meaningful stimulus, the basis of the classic BCI speller. , N170N170 A negative deflection about 170 milliseconds after seeing a face, over the back of the head on the right. , Error-related negativity (ERN)Error-related negativity (ERN) A sharp negative wave about 50 to 100 milliseconds after you make a mistake, before you consciously notice. , Trial averagingTrial averaging Adding many time-locked epochs together so the consistent response grows and the random noise shrinks by the square root of the number of trials. . Glossary entry or an offline analysis: reject with fixed rules and use ICAIndependent component analysis (ICA) A method that unmixes multichannel data into statistically independent sources, so blinks and heartbeat can be identified and removed. Related: ArtifactArtifact Anything in the recording that did not come from the brain: blinks, muscle, heartbeat, movement, sweat, mains hum, electrode pops. . Glossary entry for blinks and heart. For a real-time BCIBrain-computer interface (BCI) A system that turns measured brain activity into control of something outside the body, from a cursor to a wheelchair to a speech synthesizer. Related: DecoderDecoder The algorithm that maps neural signals to intended actions, such as a classifier or a Kalman filter. , Closed loopClosed loop A system in which the output feeds back to influence the input, such as a user adjusting their brain activity while watching the cursor it controls. . Glossary entry: ASRArtifact subspace reconstruction (ASR) An automatic method that detects short high-variance bursts and reconstructs them from clean data; common in real-time pipelines. Related: ArtifactArtifact Anything in the recording that did not come from the brain: blinks, muscle, heartbeat, movement, sweat, mains hum, electrode pops. . Glossary entry or regression, because ICAIndependent component analysis (ICA) A method that unmixes multichannel data into statistically independent sources, so blinks and heartbeat can be identified and removed. Related: ArtifactArtifact Anything in the recording that did not come from the brain: blinks, muscle, heartbeat, movement, sweat, mains hum, electrode pops. . Glossary entry cannot run online, plus rejection of windows that exceed a threshold. For a classifierClassifier An algorithm that assigns each trial a label, such as left hand or right hand, after being trained on labelled examples. Related: Linear discriminant analysis (LDA)Linear discriminant analysis (LDA) A simple, robust classifier that draws a straight boundary between classes; the workhorse of EEG decoding for two decades. , Support vector machine (SVM)Support vector machine (SVM) A classifier that finds the boundary with the widest margin between classes; strong on small datasets. , Cross-validationCross-validation Testing a model on data it never saw during training, repeatedly, so the reported accuracy means something. . Glossary entry in Phase 3: be careful that whatever you do to the training data you also do, identically and causally, to the test data, or you have leaked.
Deep dive How ICA finds the blink 4 min
Sixty-four channels, each a mixture of many sources. ICAIndependent component analysis (ICA) A method that unmixes multichannel data into statistically independent sources, so blinks and heartbeat can be identified and removed. Related: ArtifactArtifact Anything in the recording that did not come from the brain: blinks, muscle, heartbeat, movement, sweat, mains hum, electrode pops. . Glossary entry looks for a linear unmixing whose outputs are as non-Gaussian and mutually independent as possible, on the reasoning that a mixture of independent things is more Gaussian than the things themselves. Blinks are very non-Gaussian (mostly zero, occasionally large), so they are found early and cleanly. The algorithms (Infomax, FastICA, Picard) differ in how they measure independence; the results for blinks and heartbeat are nearly the same. The number of components is at most the number of channels, and you need many samples (tens of thousands) for a stable solution, which is why ICAIndependent component analysis (ICA) A method that unmixes multichannel data into statistically independent sources, so blinks and heartbeat can be identified and removed. Related: ArtifactArtifact Anything in the recording that did not come from the brain: blinks, muscle, heartbeat, movement, sweat, mains hum, electrode pops. . Glossary entry on a two-channel headband is not useful.
Deep dive Automatic labelling 2 min
Tools like ICLabel classify components as brain, eye, muscle, heart, line noise, or channel noise using a network trained on thousands of hand-labelled components. Use them to speed up review, not to replace it; check the ones it is uncertain about and any it labels brain that you plan to remove.
Explain what this page was about to your roommate in three sentences. No jargon they would not know.
We prevent artifacts with fixation, breaks, relaxed jaws, cool rooms, and fresh paste, then reject any trial beyond about 100 microvolts peak to peak using rules we fixed before seeing results. We model what remains by regressing eye signals out, separating blink and heartbeat components with independent component analysis fit on data high passed near 1 Hz, or cleaning bursts in real time with artifact subspace reconstruction. We never rely on hard band pass filtering alone, since muscle above 20 Hz and blinks in slow bands overlap the brain signal we want to keep.
Yours does not have to match. Check that the three ideas are there.