ICA: Take Out Blinks, Eye Movements, Heartbeats and Muscle Noise

New in 1.2
Topic | 13 min read

What it is

ICA, independent component analysis, splits the good channels of a recording into components, each a time course with its own map over the head. A blink, a heartbeat, a tense muscle or mains hum usually ends up in components of its own, so taking those out cleans every channel at once, and the seconds they happened in stay in the data.

The ICA step of Preprocess Signal finds the components, suggests the ones that look like an artifact and shows why. Nothing is taken out until you save, and the recording itself never changes.

How to use it

Picture of the ICA step of Preprocess Signal and its components, with sample data.
  1. Decide the bad channels first, in the Bad Channels step. Then click Find Bad Stretches in step 1 of ICA: it finds the seconds in which many channels jump at once, as when the body moves, and marks them on the line under the card.
  2. The stretches are left out of the ICA fit. To leave them out of the analyses as well, click Add to Excluded Windows.
  3. Click Run ICA in step 2. It fits the good channels outside the bad stretches, with its progress below the button; Cancel stops it. The line under the button says how many components it found from how many channels.
  4. The components appear beside the steps, the largest share of the signal first. Switch between List and Grid at the top: the list gives each component a row with its map, label and share; the grid sets the maps side by side.
  5. Tick the components to take out. The suggested ones are ticked when ICA finishes; click a component to see its detail, and untick any you want to keep. Step 3 names what is ticked.
  6. Click Apply ICA and Save. The saved run is named Preparation with ICA and has the ticked components taken out of its channels. With nothing ticked, the button is Save Preprocessing Run and the run has no ICA.

Bad stretches, and one step at a time

How a stretch is found: the recording is read in 1 s windows, high-passed at 1 Hz, with the median of the channels taken away at each sample. A window is marked when more than a quarter of the good channels are far louder than usual for them (a robust z over 5 at Standard, 6 at Lenient, 4 at Strict, the sensitivity of Suggest Bad Channels). A blink is not marked: it is on a few channels at the front, and ICA needs it to find the eye components.

The two steps run one at a time. While Find Bad Stretches is searching, Run ICA is dimmed and says it waits for the search, so that the fit leaves out what the search finds; while ICA is fitting, Find Bad Stretches waits too, since the fit keeps the stretches it started with.

Reading a component

Picture of a component's detail, with sample data.
  1. The map shows where on the head the component is strongest. Red and blue are its two signs and mean nothing on their own: a blink sits at the forehead, a muscle near one temple, a brain rhythm spreads smoothly over a region.
  2. Why it is suggested, or why it is kept: each measure behind the label, with its value and whether it is over or under the limit. With electrodes beside both eyes it also shows Signal beside the eyes and F7 side against F8 side, the measures of a look to the side; for such a map the limit below 4 Hz is 40 %.
  3. The spectrum, from 1 Hz: a brain component falls with frequency, often with a peak near 10 Hz; a muscle stays high above 20 Hz; line noise is one sharp peak at 50 or 60 Hz.
  4. The first 10 s of the component: blinks are tall separate bumps, a heartbeat repeats about once a second, a muscle is dense fast activity.
  5. Before and after: the channels the ticked components reach most, over the same 10 s, before and after taking them out. It shows what saving will change.
  6. Remove ticks or unticks this component, as its tick in the list does.

The labels

Each component is measured and given the first label whose rule it meets, in this order. Every label but Brain is suggested for removal.

Eye, a blink or a look up or down: over 45 % of the map on the forehead electrodes (Fp and AF) and over half of the power below 4 Hz, or a correlation over 0.6 with an EOG channel.

Heart: a correlation over 0.6 with an ECG channel.

Line noise: a 50 or 60 Hz peak over 8 times the power just around it, checked when the sample rate is 120 Hz or more. Line-noise notch, under Detrend and filters, takes the line out of every channel whatever ICA finds.

Muscle: a spectrum that hardly falls from 7 to 45 Hz (a slope of log power over log frequency above −0.5) with over 45 % of the power above 20 Hz.

One channel: the largest weight of the map over 3 times the next, a component that lives in one electrode.

Eye, a look to the side: a component none of the rules above takes, whose map is strong beside both eyes with opposite signs and with over 40 % of its power below 4 Hz. Beside the eyes means F7, AF7, FT7 and F9 on the left and F8, AF8, FT8 and F10 on the right: over 35 % of the map lies there, and the weaker side is at least half the stronger, with the other sign (F7 side against F8 side under −0.5).

Brain: any other component. It is kept unless you tick it.

The powers are shares of 1 to 45 Hz. The rules follow MNE-Python's find_bads_eog and find_bads_ecg (correlation with an EOG or ECG channel) and Dharmaprani and others (2016) for muscle.

Why the limits are where they are

The limits were checked against ICLabel, a classifier trained on components that experts labelled, on 12 PhysioNet recordings of 64 channels. The validation page has every figure.

A look to the side. The front of the eye is positive, so when the eyes turn left the left side of the head becomes positive and the right negative, and the other way round. Without this rule such components were kept as Brain. On the 12 recordings it labels 8 components Eye: ICLabel calls 7 of them Eye and 1 Brain, with a probability of only 0.50. A look is a quick step, not a slow bump like a blink, so less of its power lies below 4 Hz: its limit is 40 %, not 50 %.

Muscle at 45 %, not 35 %. At 35 % the rule also took many small components that mix a little of everything, and ticked them, which takes some brain signal out with them. At 45 % it labels 37 components Muscle instead of 57 and still finds 22 of the 24 that ICLabel calls Muscle; ICLabel itself is unsure of the 2 it misses.

Line noise stays at 8. Of the 14 components ICLabel calls Line Noise, the rule takes the 2 with a clear peak, 22 and 27 times the power around it. In the other 12 the peak is at most 5.6 times its surroundings, often there is none, and 11 of them hold under 2 % of the signal. A limit of 3 would take 6 of them, but also 5 components ICLabel calls Brain. Tick one yourself if its spectrum has a sharp peak at 50 or 60 Hz.

Look at the cleaned signal

Picture of a saved run with ICA: its card, its tab with Show Original, and the tab's inspector, with sample data.
  1. After Apply ICA and Save, the ICA step shows the new run with Open in Tab, Export BDF+… and Use in Analysis. The run's page under Workspace > Preprocessing Runs has Open in Tab and Export BDF+… too.
  2. Open in Tab shows the run's signal in a temporary tab of its own, named after the recording with ICA cleaned after it. The recording's own tab is unchanged.
  3. Show Original, in the tab's toolbar, draws the same run without its ICA in grey under each row, so what the components took out stands out: blinks at Fp1 and Fp2, for example.
  4. The tab's inspector says what it shows: the run, the components removed, its bad channels and where the original is. Its Export BDF+… and the toolbar's Export write the run's signal; its Use in Analysis opens Power Spectral Analysis on it, and every module opened from the tab uses the run.
  5. Export BDF+… opens Export Segment with the run as the source: the run's channels, its bad channels in red, and a 24-bit BDF+ file whose header and first annotation say it was cleaned with ICA.

What saving does

A run with ICA is made in this order: the bad channels are left out; the filters you set are applied; the ticked components are taken out of the good channels; the bad channels are rebuilt from the cleaned channels, if Interpolate in the result is on; then the reference you chose is applied.

ICA works in the average reference, so with Keep current reference the cleaned channels stay average referenced.

The components are found on a copy of the channels high-passed at 1 Hz, which separates them better, and taken out of the run's own filtered signal.

How much recording it needs

ICA needs about 20 samples for each weight it fits: 20 × r² samples for r components. 64 channels (63 components after the average reference) need about 79,000 samples, 8 minutes at 160 Hz; 19 channels need about 6,500, under a minute at 128 Hz.

With less, it fits only the components the recording supports, and step 2 says so. A longer recording separates more.

At least 8 good channels are needed. To keep the fit quick, a long recording gives every second, third or later sample, so that about 30 × r² samples remain, taken evenly from the whole recording outside the bad stretches; a shorter one gives all of its samples.

To keep within memory, the fit holds at most 24 million values. With 64 channels that covers every component; with 128 channels it is about 187,500 samples, enough for about 96 of the 127 components, and step 2 says so. Fewer channels fit more of theirs.

A long recording with many channels takes a while. On a Mac, ICA reads 2 hours of 128 channels at 2048 Hz in about 1.5 minutes, then takes up to about 3 s a pass: up to about 50 minutes if it runs all 1,000 passes, less when it settles sooner. Cancel stops it within a second, and nothing changes until you save.

The method

Extended Infomax (Lee, Girolami and Sejnowski, 1999), with the settings of EEGLAB's runica: the channels are first reduced to their rank with PCA, then the weights are learned in small blocks until they stop changing (where runica stops), or for at most 1,000 passes.

Its starting point is fixed, so the same recording and settings give the same components every time.

Components are numbered by their share of the signal, IC00 the largest.

Which channels it uses

The good scalp channels of the bad-channel check: every voltage channel on the scalp at the recording's main rate, without the ones marked bad.

An EOG or ECG channel is not part of the fit. When the recording has one, it is used to recognise eye and heart components.

Where it is kept

The last fit, the bad stretches and your ticks are kept with the recording on this device, so closing Preprocess Signal loses nothing. Find Again and Run Again replace them.

When the bad channels or stretches change after a fit, step 2 says so, and the run is saved without ICA until you run it again.

A saved run keeps its own copy of the components and of what was taken out.

The original file and the exports

The original recording never changes. The run's Data & Processing History names the method, the components, the samples and passes of the fit, the stretches left out of it and each component taken out.

Every analysis, export and Research Handoff that uses the run reads the cleaned signal: the components are taken out of whichever channels it asks for.

A Research Handoff of the run carries its components in analysis/preprocessing-report.json. Its MNE-Python loader returns them with load_preprocessing, and its EEGLAB loader puts the components kept in EEG.icaweights and EEG.icawinv, as after pop_subcomp.

Hide, delete, undo

Untick a component to keep it. With nothing ticked, the run is saved without ICA.

Find Again and Run Again start the search and the fit afresh; your ticks then start from the new suggestions.

How accurate it is

On synthetic data, six known sources mixed into six channels, each source is found again with a correlation over 0.95, and taking one component out leaves under 1 % of its power while the others keep a correlation over 0.98.

On 12 PhysioNet recordings of 64 channels, the components are those EEGLAB's runica finds in the same data (their maps correlate at a median of 0.9996), and as close to MNE-Python's as two MNE-Python fits are to each other.

A one-minute recording is short for 64 channels: its fit can stop at 1,000 passes without settling, as runica's does on the same file, and step 2 says so.

On the same recordings, ICLabel, a trained classifier, agrees with the suggestions on whether to take a component out for 87 % of the components. Of the components ICLabel calls Eye the suggestions find 17 of 20, of those it calls Muscle 22 of 24.

Taking out the Eye components takes the same share of the slow power at Fp1 and Fp2 as taking out the matching components of EEGLAB or MNE-Python, to within 1.3 points. The validation page has the figures.

Limits

The labels are rules of thumb, not a trained classifier such as ICLabel. A component can mix brain activity and an artifact; look at its map, spectrum and time course before you take it out.

Heart is suggested only from an ECG channel. Without one, a heartbeat component is labelled Brain: its time course repeats about once a second, with a sharp spike each time; tick it yourself. With one, the component must correlate over 0.6 with it; in one of four EEGMAT recordings the heartbeat's correlated 0.55 and stayed Brain.

An EOG channel helps only when it follows the eyes closely: electrodes near the eyes recorded like the others may correlate under 0.6 (about 0.3 in EEGLAB's sample recording). The forehead and sideways rules still find blinks and looks there.

The limits were set on 12 recordings of 3 people, at rest and moving or imagining moving their hands. A beta rhythm over the motor strip can be labelled Muscle: a muscle sits at the edge of the head, near a temple or the neck. With only F7 and F8 beside the eyes, as on a 10-20 cap, a look to the side rests on those two electrodes.

Taking a component out also takes out the brain activity in it. A short recording gives fewer components, and an artifact is then more likely to share one with brain activity.

The suggestions are for research review. They are not a clinical judgement.

Recommended for

Recordings with blinks, eye movements, heartbeats or muscle tension, a few minutes long or more, with 16 channels or more.

Mark the bad channels and find the bad stretches first, and take out only what you are sure of. For a few short artifacts, Excluded Windows may be simpler.

ICA: Take Out Blinks, Eye Movements, Heartbeats and Muscle Noise

New in 1.2
Topic | 12 min read

What it is

ICA, independent component analysis, splits the good channels of a recording into components, each a time course with its own map over the head. A blink, a heartbeat, a tense muscle or mains hum usually ends up in components of its own, so taking those out cleans every channel at once, and the seconds they happened in stay in the data.

The ICA step of Preprocess Signal finds the components, suggests the ones that look like an artifact and shows why. Nothing is taken out until you save, and the recording itself never changes.

How to use it

Picture of the ICA step of Preprocess and its components, with sample data.
  1. Find Again looks for bad stretches, such as big movements, and leaves them out of the fit.
  2. Run Again fits ICA on the rest. It takes about a minute.
  3. Grid shows the scalp maps two to a row; List shows one a row, with its label and its share of the signal.
  4. Ticked components are removed. Untick any you want to keep.

Decide the bad channels first, in the Bad Channels step. A bad stretch is a second in which many channels jump at once, as when the body moves.

The stretches are left out of the ICA fit. To leave them out of the analyses as well, tap Add to Excluded Windows before Run ICA.

While ICA is fitting, its progress takes Run ICA's place; Cancel stops it. Then the ICA row says how many components it found from how many channels.

Tap a component to see it up close. Then save on the Save step: Apply ICA and Save takes the ticked components out, and the saved run is named Preparation with ICA. With nothing ticked, the button is Save Preprocessing Run and the run has no ICA.

Bad stretches, and one step at a time

How a stretch is found: the recording is read in 1 s windows, high-passed at 1 Hz, with the median of the channels taken away at each sample. A window is marked when more than a quarter of the good channels are far louder than usual for them (a robust z over 5 at Standard, 6 at Lenient, 4 at Strict, the sensitivity of Suggest Bad Channels). A blink is not marked: it is on a few channels at the front, and ICA needs it to find the eye components.

The two steps run one at a time. Run ICA does nothing while Find is searching, so that the fit leaves out what the search finds, and Find does nothing while ICA is fitting.

A component up close

Picture of a component up close, with sample data.
  1. The component's scalp map: where it is strongest.
  2. Remove takes it out of the cleaned signal.
  3. Why it is suggested: each check, its value and its limit.
  4. Time course and Spectrum show its own signal.

Tap a component in the grid or the list to open its page; ⌃ and ⌄ go to the one before or after.

The map's red and blue are its two signs and mean nothing on their own: a blink sits at the forehead, a muscle near one temple, a brain rhythm spreads smoothly over a region.

The spectrum, from 1 Hz: a brain component falls with frequency, often with a peak near 10 Hz; a muscle stays high above 20 Hz; line noise is one sharp peak at 50 or 60 Hz.

The time course, the first 10 s: blinks are tall separate bumps, a heartbeat repeats about once a second, a muscle is dense fast activity.

With electrodes beside both eyes, Why it is suggested also shows Signal beside the eyes and F7 side against F8 side, the measures of a look to the side; for such a map the limit below 4 Hz is 40 %.

The labels

Each component is measured and given the first label whose rule it meets, in this order. Every label but Brain is suggested for removal.

Eye, a blink or a look up or down: over 45 % of the map on the forehead electrodes (Fp and AF) and over half of the power below 4 Hz, or a correlation over 0.6 with an EOG channel.

Heart: a correlation over 0.6 with an ECG channel.

Line noise: a 50 or 60 Hz peak over 8 times the power just around it, checked when the sample rate is 120 Hz or more. Line-noise notch, under Detrend and filters, takes the line out of every channel whatever ICA finds.

Muscle: a spectrum that hardly falls from 7 to 45 Hz (a slope of log power over log frequency above −0.5) with over 45 % of the power above 20 Hz.

One channel: the largest weight of the map over 3 times the next, a component that lives in one electrode.

Eye, a look to the side: a component none of the rules above takes, whose map is strong beside both eyes with opposite signs and with over 40 % of its power below 4 Hz. Beside the eyes means F7, AF7, FT7 and F9 on the left and F8, AF8, FT8 and F10 on the right: over 35 % of the map lies there, and the weaker side is at least half the stronger, with the other sign (F7 side against F8 side under −0.5).

Brain: any other component. It is kept unless you tick it.

The powers are shares of 1 to 45 Hz. The rules follow MNE-Python's find_bads_eog and find_bads_ecg (correlation with an EOG or ECG channel) and Dharmaprani and others (2016) for muscle.

Why the limits are where they are

The limits were checked against ICLabel, a classifier trained on components that experts labelled, on 12 PhysioNet recordings of 64 channels. The validation page has every figure.

A look to the side. The front of the eye is positive, so when the eyes turn left the left side of the head becomes positive and the right negative, and the other way round. Without this rule such components were kept as Brain. On the 12 recordings it labels 8 components Eye: ICLabel calls 7 of them Eye and 1 Brain, with a probability of only 0.50. A look is a quick step, not a slow bump like a blink, so less of its power lies below 4 Hz: its limit is 40 %, not 50 %.

Muscle at 45 %, not 35 %. At 35 % the rule also took many small components that mix a little of everything, and ticked them, which takes some brain signal out with them. At 45 % it labels 37 components Muscle instead of 57 and still finds 22 of the 24 that ICLabel calls Muscle; ICLabel itself is unsure of the 2 it misses.

Line noise stays at 8. Of the 14 components ICLabel calls Line Noise, the rule takes the 2 with a clear peak, 22 and 27 times the power around it. In the other 12 the peak is at most 5.6 times its surroundings, often there is none, and 11 of them hold under 2 % of the signal. A limit of 3 would take 6 of them, but also 5 components ICLabel calls Brain. Tick one yourself if its spectrum has a sharp peak at 50 or 60 Hz.

The cleaned signal

After Apply ICA and Save, the Save step shows the run with Open Cleaned Signal, Export Cleaned Signal… and Use in Analysis. Clean a Recording shows the cleaned signal in the Viewer.

Export Cleaned Signal… opens Export Segment with the run as the source: the run's channels, with its bad channels in red. The file's header and first annotation say it was cleaned with ICA.

What saving does

A run with ICA is made in this order: the bad channels are left out; the filters you set are applied; the ticked components are taken out of the good channels; the bad channels are rebuilt from the cleaned channels, if Interpolate in the result is on; then the reference you chose is applied.

ICA works in the average reference, so with As Recorded the cleaned channels stay average referenced.

The components are found on a copy of the channels high-passed at 1 Hz, which separates them better, and taken out of the run's own filtered signal.

How much recording it needs

ICA needs about 20 samples for each weight it fits: 20 × r² samples for r components. 64 channels (63 components after the average reference) need about 79,000 samples, 8 minutes at 160 Hz; 19 channels need about 6,500, under a minute at 128 Hz.

With less, it fits only the components the recording supports, and the ICA step says so. A longer recording separates more.

At least 8 good channels are needed. To keep the fit quick, a long recording gives every second, third or later sample, so that about 30 × r² samples remain, taken evenly from the whole recording outside the bad stretches; a shorter one gives all of its samples.

To keep within memory, the fit holds at most 24 million values. With 64 channels that covers every component; with 128 channels it is about 187,500 samples, enough for about 96 of the 127 components, and the ICA step says so. Fewer channels fit more of theirs.

A long recording with many channels takes a while: the fit makes up to 1,000 passes, fewer when it settles sooner. Cancel stops it within a second, and nothing changes until you save.

The method

Extended Infomax (Lee, Girolami and Sejnowski, 1999), with the settings of EEGLAB's runica: the channels are first reduced to their rank with PCA, then the weights are learned in small blocks until they stop changing (where runica stops), or for at most 1,000 passes.

Its starting point is fixed, so the same recording and settings give the same components every time.

Components are numbered by their share of the signal, IC00 the largest.

Which channels it uses

The good scalp channels of the bad-channel check: every voltage channel on the scalp at the recording's main rate, without the ones marked bad.

An EOG or ECG channel is not part of the fit. When the recording has one, it is used to recognise eye and heart components.

Where it is kept

The last fit, the bad stretches and your ticks are kept with the recording on this device, so leaving Preprocess Signal loses nothing. Find Again and Run Again replace them.

When the bad channels or stretches change after a fit, the ICA step says so, and the run is saved without ICA until you run it again.

A saved run keeps its own copy of the components and of what was taken out.

The original file and the exports

The original recording never changes. The run's Data & Processing History names the method, the components, the samples and passes of the fit, the stretches left out of it and each component taken out.

Every analysis, export and Research Handoff that uses the run reads the cleaned signal: the components are taken out of whichever channels it asks for.

A Research Handoff of the run carries its components in analysis/preprocessing-report.json. Its MNE-Python loader returns them with load_preprocessing, and its EEGLAB loader puts the components kept in EEG.icaweights and EEG.icawinv, as after pop_subcomp.

Hide, delete, undo

Untick a component to keep it. With nothing ticked, the run is saved without ICA.

Find Again and Run Again start the search and the fit afresh; your ticks then start from the new suggestions.

How accurate it is

On synthetic data, six known sources mixed into six channels, each source is found again with a correlation over 0.95, and taking one component out leaves under 1 % of its power while the others keep a correlation over 0.98.

On 12 PhysioNet recordings of 64 channels, the components are those EEGLAB's runica finds in the same data (their maps correlate at a median of 0.9996), and as close to MNE-Python's as two MNE-Python fits are to each other.

A one-minute recording is short for 64 channels: its fit can stop at 1,000 passes without settling, as runica's does on the same file.

On the same recordings, ICLabel, a trained classifier, agrees with the suggestions on whether to take a component out for 87 % of the components. Of the components ICLabel calls Eye the suggestions find 17 of 20, of those it calls Muscle 22 of 24.

Taking out the Eye components takes the same share of the slow power at Fp1 and Fp2 as taking out the matching components of EEGLAB or MNE-Python, to within 1.3 points. The validation page has the figures.

Limits

The labels are rules of thumb, not a trained classifier such as ICLabel. A component can mix brain activity and an artifact; look at its map, spectrum and time course before you take it out.

Heart is suggested only from an ECG channel. Without one, a heartbeat component is labelled Brain: its time course repeats about once a second, with a sharp spike each time; tick it yourself. With one, the component must correlate over 0.6 with it; in one of four EEGMAT recordings the heartbeat's correlated 0.55 and stayed Brain.

An EOG channel helps only when it follows the eyes closely: electrodes near the eyes recorded like the others may correlate under 0.6 (about 0.3 in EEGLAB's sample recording). The forehead and sideways rules still find blinks and looks there.

The limits were set on 12 recordings of 3 people, at rest and moving or imagining moving their hands. A beta rhythm over the motor strip can be labelled Muscle: a muscle sits at the edge of the head, near a temple or the neck. With only F7 and F8 beside the eyes, as on a 10-20 cap, a look to the side rests on those two electrodes.

Taking a component out also takes out the brain activity in it. A short recording gives fewer components, and an artifact is then more likely to share one with brain activity.

The suggestions are for research review. They are not a clinical judgement.

Recommended for

Recordings with blinks, eye movements, heartbeats or muscle tension, a few minutes long or more, with 16 channels or more.

Mark the bad channels and find the bad stretches first, and take out only what you are sure of. For a few short artifacts, Excluded Windows may be simpler.