braindecode.preprocessing.RemoveBursts#
- class braindecode.preprocessing.RemoveBursts(*, cutoff=10.0, window_len=None, step_size=None, max_dims=0.66, ref_maxbadchannels=0.075, ref_tolerances=(-inf, 5.5), ref_wndlen=1.0, maxmem=64)[source]#
 Run the Artifact Subspace Reconstruction (ASR) method on EEG data to remove burst-type artifacts. Follows [Mullen2015].
This is an automated artifact rejection function that ensures that the data contains no events that have abnormally strong power; the subspaces on which those events occur are reconstructed (interpolated) based on the rest of the EEG signal during these time periods.
Preconditions:
One of
RemoveDriftsorbraindecode.preprocessing.Filter( configured as a highpass filter) must have been applied beforehand.Must have removed flat-line channels beforehand with
RemoveFlatChannels.If you are removing bad channels (
RemoveBadChannelsorRemoveBadChannelsNoLocs), use those before this step.Consider applying
RemoveDCOffsetbeforehand as a general best practice.If you are re-referencing to common average (
RemoveCommonAverageReference), this should normally NOT be done before this step, but after it.
- Parameters:
 cutoff (float) – Threshold for artifact rejection. Data portions whose variance is larger than this threshold relative to the calibration data are considered artifactual and removed. There is a fair amount of literature on what constitutes a good value. 7.5 is very aggressive, 10-15 is a good range for ML pipelines, 20-30 is more forgiving and is more common in neuroscience applications. The unit is z-scores relative to a Gaussian component of background EEG, but since EEG phenomena of interest can stand out from the Gaussian background, typical thresholds are considerably larger than for a purely Gaussian distribution. Default is 10.0.
window_len (float | None) – Length of the statistics window in seconds. Should not be much longer than artifact timescale. The number of samples in the window should be >= 1.5x channels. Default: max(0.5, 1.5 * nbchan / srate).
step_size (int | None) – Step size for processing in samples. The reconstruction matrix is updated every this many samples. If None, defaults to window_len / 2 samples.
max_dims (float) – Maximum dimensionality/fraction of dimensions to reconstruct. Default: 0.66. This can be understood to be the number of simultaneous artifact components that may be removed; normally needs no tuning, but on very low-channel data (e.g., 4ch) one may exploring small integers between 1 and #channels-1.
ref_maxbadchannels (float | None) – Parameter that controls automatic calibration data selection. This represents the max fraction (0-1) of bad channels tolerated in a window for it to be used as calibration data. Lower is more aggressive (e.g., 0.05). Default: 0.075. The parameter has the same meaning as the max_bad_channels parameter in the RemoveBadWindows preprocessor, but note that this stage is used here as a subroutine to identify calibration data only. The overall method will always output a data matrix of the same shape as the input data. If set to None, all data is used for calibration.
ref_tolerances (tuple[float, float]) – Power tolerances (lower, upper) in SDs from robust EEG power for a channel to be considered ‘bad’ during calibration data selection. This parameter goes hand in hand with ref_maxbadchannels. Default: (-inf, 5.5).
ref_wndlen (float) – Window length in seconds for calibration data selection granularity. Default: 1.0.
maxmem (int) – Maximum memory (in MB) to use during processing. Larger values can reduce overhead during processing, but usually 64MB is sufficient.
References
[Mullen2015]Mullen, T.R., Kothe, C.A., Chi, Y.M., Ojeda, A., Kerth, T., Makeig, S., Jung, T.P. and Cauwenberghs, G., 2015. Real-time neuroimaging and cognitive monitoring using wearable dry EEG. IEEE Transactions on Biomedical Engineering, 62(11), pp.2553-2567.
Methods