Artifact Subspace Reconstruction

Explore Desktop can clean incoming ExG data in real time using Artifact Subspace Reconstruction, or ASR, and visualize the cleaned signal next to the original signal.

ASR is an adaptive method for reducing high-amplitude artifacts, such as those caused by eye blinks, jaw clenching, muscle activity, movement, or electrode disturbances, in multi-channel EEG. It first learns what clean data looks like for your setup from a short calibration recording. It then continuously compares incoming data against that reference and reconstructs the parts that deviate too strongly from it, using the remaining, unaffected channels.

ASR in Explore Desktop is a real-time visualization and streaming feature. To apply ASR to an existing recording after a session, use Explore Signals and refer to the Artifact Subspace Reconstruction section in the Explore Signals Guide.
ASR can remove brain signal along with artifacts. If you plan to work with cleaned data, make sure you understand the method and its limitations before drawing conclusions from it.

Before you start

ASR works best when the following conditions are met:

  • The signal is EEG. The algorithm is designed for EEG. Output for other biosignals, such as ECG or EMG, may be worse, because more signal than artifact may be removed.

  • Several channels are active. ASR reconstructs an affected channel from the other channels, so it needs multiple channels to work with. Research suggests that ASR achieves effective artifact reduction for a standard 20-channel EEG[1]. Accuracy improves with higher channel counts and higher sampling rates.

  • Signal quality is good. Check your impedances before calibrating. Calibration may fail when using dry electrodes or when the signal quality is low.

  • Impedance measurement is turned off. ASR is not available while impedance measurement is running. If you open the ASR dialog during an impedance measurement, Explore Desktop reports that the ASR processor is not available.

Opening the ASR settings

To open the ASR settings, navigate to the Visualization page and click ASR in the toolbar above the plot, next to Filters.

The ASR button in the Visualization page toolbar.
The ASR button on the Visualization page

The button immediately to the right of ASR is the draw mode button. It shows the currently selected draw mode.

This opens the ASR Settings dialog, which is divided into two sections:

  • Calibration settings — teach ASR what clean data looks like for your setup.

  • Reconstruction settings — control how strongly data is cleaned, how often it is cleaned, and how it is displayed.

The Reconstruction settings section stays disabled until calibration data is available.

The ASR Settings dialog before calibration.
The ASR Settings dialog, before calibration

In the state shown above, ASR has not been calibrated yet. The status text reads No calibration data available. and cleaning cannot be started.

Workflow

The typical workflow is:

  1. Calibrate ASR, either by recording resting-state data or by loading calibration data from a file.

  2. Adjust the reconstruction settings if needed.

  3. Click Start cleaning data.

  4. Select a draw mode to compare the original and cleaned signals.

Calibration

ASR needs a reference for what clean data looks like on your subject, montage, and device configuration. This reference is built from a short calibration recording that should contain as few artifacts as possible.

Explore Desktop does not use the calibration recording as-is. It first filters the data, then automatically discards the noisiest windows and any flat channels, and computes the ASR reference from what remains. Because of this, calibration fails if too little usable data is left over.

Recording calibration data

To calibrate ASR:

  1. Set Calibration window length to the number of seconds of data you want to record.

    The default is 30 s. The accepted range is 10 s to 120 s.

  2. Ask the subject to sit still and relaxed, with eyes open and blinking kept to a minimum. Avoid jaw clenching, talking, and head movement for the duration of the calibration.

  3. Click Calibrate.

    The button changes to Calibrating…​ and stays disabled until calibration finishes.

  4. Wait for the status text below the buttons to change.

The status text reports the state of calibration:

Status text Meaning

No calibration data available.

ASR has no reference yet. Cleaning cannot be started.

Calibration data is being cleaned.

Calibration finished recording and Explore Desktop is preparing the reference. This step takes a moment.

Calibration data available.

ASR is calibrated and ready. The Reconstruction settings section is now enabled.

If calibration fails, Explore Desktop reports a calibration error and the reference is not created. This usually means the calibration recording contained too many artifacts or the signal quality was too low.

To recover from a failed calibration:

  • Check and improve your impedances, then calibrate again.

  • Increase the calibration window length so that more usable data is available.

  • Make sure the subject stays still and relaxed while calibration is running.

You cannot calibrate while ASR is cleaning data. Click Stop cleaning data first, then calibrate again.

Loading calibration data from a file

Instead of recording new calibration data, you can reuse a clean segment from an earlier session. This is useful when you want the same reference across sessions, or when the current subject cannot easily hold still.

To load calibration data:

  1. Click Load calibration data from file.

  2. Select a .csv file.

Explore Desktop checks the file against the connected device before using it. The file must satisfy all of the following:

  • It contains a TimeStamp column.

  • It contains exactly one column per channel of the connected device, in addition to the TimeStamp column.

  • The column names match the channel names configured on the Settings page. The comparison ignores capitalization.

  • The sampling rate implied by the timestamps matches the sampling rate of the connected device.

If any check fails, Explore Desktop lists the reasons why the file could not be loaded, so you can correct the file or the device configuration and try again.

A .csv file recorded with Explore Desktop satisfies these conditions as long as the channel names and the sampling rate still match the current device configuration.

Loading a file replaces the current ASR reference. If the loaded segment is too noisy to build a stable reference from, Explore Desktop reports that the calibration data could not be used and keeps ASR uncalibrated. In that case, choose a cleaner segment.

When calibration is discarded

The ASR reference is tied to the current device configuration. It is discarded when:

  • the device is disconnected, or

  • device settings such as the sampling rate are changed.

After either of these, calibrate again before cleaning data.

Reconstruction settings

ASR cutoff

The ASR cutoff (σ) field sets the standard deviation cutoff used during cleaning. It determines the threshold, relative to the calibration data, above which a portion of the signal is treated as an artifact and reconstructed.

  • A lower cutoff causes more data to be recognized as artifacts, resulting in stronger cleaning.

  • A higher cutoff causes less data to be recognized as artifacts, preserving more of the original signal.

The default is 5.0 and the accepted range is 3.0 to 20.0.

Common reference points are:

  • 3.0 — aggressive

  • 5.0 — standard, and the default in Explore Desktop and Explore Signals

  • 20.0 — conservative

To change the cutoff, enter a new value and click Apply next to the field.

Applying a new cutoff rebuilds the ASR reference from the calibration data you already recorded or loaded. You do not need to calibrate again.

Calculation rate

The Calculation rate (in s) field sets how often ASR runs over the incoming data.

Explore Desktop keeps a rolling buffer of the most recent 5 s of raw data. Every time the calculation rate elapses, ASR is applied to that buffer and the newly cleaned samples are handed to the plot and, if enabled, to the LSL stream.

  • A lower value updates the cleaned trace more frequently and reduces the delay before you see the effect of ASR.

  • A higher value uses more accumulated data per pass and reduces the processing load.

The field opens at 1.0 s and the accepted range is 0.1 s to 5.0 s.

To change the calculation rate, enter a new value and click Apply next to the field.

Low calculation rates increase CPU load, particularly at high channel counts and high sampling rates. If the visualization becomes sluggish, increase the calculation rate.

ASR draw mode

The ASR draw mode setting controls how the original and cleaned signals are drawn on the Visualization page:

Draw mode Displayed signal

Original

Only the original, uncleaned signal, in blue. This is the standard Visualization page view.

Cleaned

Only the ASR-cleaned signal, in orange.

Overlay

Both signals at once. The original signal is drawn in a lighter blue and the cleaned signal in orange, so that you can see exactly which parts of the signal ASR changed.

Overlay is the most useful mode while you are tuning the cutoff, because it shows what ASR reduced and what it left untouched.

The Visualization page in Overlay draw mode, showing the original signal in blue and the cleaned signal in orange.
Overlay draw mode, with the original signal in blue and the cleaned signal in orange

In the example above, the large deflections in the blue trace are artifacts. The orange trace shows the same data after ASR has reconstructed the affected segments.

Whenever cleaned data is drawn, a legend above the plot identifies the two traces as Raw/Filtered data and Cleaned data.

You can change the draw mode either from the drop-down menu in the ASR Settings dialog or from the draw mode button next to ASR on the Visualization page. Clicking that button cycles through Original, Cleaned, and Overlay. It shows the currently selected mode and stays greyed out until ASR has been calibrated.

Starting and stopping cleaning

To start cleaning, click Start cleaning data in the ASR Settings dialog. The button then changes to Stop cleaning data.

If the draw mode is still set to Original when you start cleaning, Explore Desktop switches it to Overlay automatically so that you can see the result immediately.

To stop cleaning, click Stop cleaning data. The plot keeps showing the cleaned samples that were already computed, so you can still switch draw modes and scroll back through them.

What ASR does and does not affect

ASR runs on the raw data coming from the device, in parallel with the normal visualization path.

  • Filters. ASR applies its own filters internally, independently of the settings in the Filters dialog. It applies a band-stop filter between 45 Hz and 55 Hz and a band-pass filter up to 40 Hz, with a lower edge of 0.1 Hz below a sampling rate of 1000 Hz and 2 Hz at and above it. Changing the visualization filters therefore does not change the cleaned trace, and the two traces may differ in baseline and in high-frequency content even where ASR changed nothing.

  • Recordings. Recordings made with Record contain the raw data from the device. Enabling ASR does not change what is written to file. To keep a cleaned copy of a session, either stream the cleaned data over LSL and record it with LSL-aware software, or apply ASR to the recording afterwards in Explore Signals.

  • Impedance measurement. ASR and impedance measurement cannot run at the same time.

Streaming cleaned data over LSL

Explore Desktop can push the ASR-cleaned signal to Lab Streaming Layer instead of the raw signal.

To stream cleaned data:

  1. Calibrate ASR and click Start cleaning data.

  2. Close the ASR Settings dialog and click LSL on the Visualization page.

  3. Select the Push ASR cleaned, filtered data checkbox.

  4. Click Push data to LSL.

The checkbox can only be selected while ASR is cleaning data and while Explore Desktop is not already pushing to LSL. To switch between raw and cleaned data, stop pushing to LSL, change the checkbox, and start pushing again.

The stream names do not change when you push cleaned data. The ExG stream is still published as Explore_<DEVICE_ID>_ExG. Only its contents change.

Because the stream name and metadata are identical, receiving software cannot tell whether a stream carries raw or ASR-cleaned data. Note in your experiment records which of the two you streamed.

While cleaned data is being pushed to LSL, the calibration controls and the Start cleaning data button in the ASR Settings dialog are disabled. Stop pushing to LSL to re-enable them.

For general information about LSL in Explore Desktop, refer to the Lab Streaming Layer page.

Parameter reference

Parameter Default Range Effect

Calibration window length

30 s

10 s to 120 s

Length of the resting-state recording used to build the ASR reference. Longer windows give a more reliable reference but take longer to record.

ASR cutoff (σ)

5.0

3.0 to 20.0

Standard deviation threshold for treating a portion of the signal as an artifact. Lower values clean more aggressively.

Calculation rate

1.0 s

0.1 s to 5.0 s

How often ASR is applied to the rolling 5 s buffer of raw data. Lower values update the cleaned trace more frequently at a higher processing cost.

ASR draw mode

Original

Original, Cleaned, Overlay

Which of the two traces is drawn on the Visualization page.

Troubleshooting

Message or symptom What to do

ASR processor is not available

Impedance measurement is running, or the device is not fully connected. Turn off impedance measurement and try again.

Calibration not possible because ASR is running

Click Stop cleaning data, then calibrate again.

Calibration error, or the calibration data could not be cleaned

The calibration segment contained too many artifacts. Improve impedances, keep the subject still, increase the calibration window length, and calibrate again.

The loaded calibration file is rejected

Check that the file has a TimeStamp column, one column per device channel, channel names matching the Settings page, and the same sampling rate as the connected device.

The reconstruction settings are greyed out

No calibration data is available yet. Calibrate, or load calibration data from a file.

The draw mode button is greyed out

ASR is not calibrated yet. Calibrate, or load calibration data from a file.

The cleaned trace does not line up with the original trace

ASR filters its input internally and produces a zero-mean signal. A baseline offset between the two traces is expected, especially when the visualization filters differ from the internal ASR filters.

The visualization becomes sluggish after starting ASR

Increase the calculation rate, reduce the number of visible channels, or lower the sampling rate.

For more information or support, contact support@mentalab.com.

References

  • [1] Chang, Chi-Yuan, et al. "Evaluation of artifact subspace reconstruction for automatic artifact components removal in multi-channel EEG recordings." IEEE Transactions on Biomedical Engineering 67.4 (2019): 1114-1121.