braindecode.preprocessing.RemoveFlatChannels#
- class braindecode.preprocessing.RemoveFlatChannels(*, max_flatline_duration=5.0, max_allowed_jitter=20.0)[source]#
 Removes EEG channels that flat-line for extended periods of time. Follows [Mullen2015].
This is an automated artifact rejection function which ensures that the data contains no flat-lined channels. This is very rarely the case, but the preprocessor exists since the presence of such channels may throw off downstream preproc steps.
This step is best placed very early in a preprocessing pipeline, before any filtering (since filter pre/post ringing can mask flatlines).
A channel \(c\) is flagged as flat if there exists a time interval \([t_1, t_2]\) where:
\[ \begin{align}\begin{aligned}|X_{c,t+1} - X_{c,t}| < \varepsilon_{\text{jitter}} \quad \forall t \in [t_1, t_2]\\\text{and} \quad t_2 - t_1 > T_{\text{max}}\end{aligned}\end{align} \]where \(\varepsilon_{\text{jitter}} = \text{max_allowed_jitter} \times \varepsilon\) (with \(\varepsilon\) being machine epsilon for float64), and \(T_{\text{max}} = \text{max_flatline_duration} \times f_s\) (with \(f_s\) being the sampling rate).
- Parameters:
 max_flatline_duration (float) – Maximum tolerated flatline duration. In seconds. If a channel has a longer flatline than this, it will be considered abnormal. Defaults to 5.0.
max_allowed_jitter (float) – Maximum tolerated jitter during flatlines. As a multiple of epsilon for the 64-bit float data type (np.finfo(np.float64).eps). Defaults to 20.
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