braindecode.preprocessing.Resampling#
- class braindecode.preprocessing.Resampling(sfreq)[source]#
 Resample the data to a specified rate (EEGPrep version). Based on [Proakis2007] and included for equivalence with EEGPrep.
MNE has its resampling routine (use as Preprocessor(“resample”, sfreq=rate)) but this will not necessarily match EEGPrep’s behavior exactly. Typical differences include edge padding, the exact design rule for the filter kernel and its window function, and handling of resampling ratios with large rational factors.
It’s not necessarily clear which of the two implementations is “better” (likely both are fine for typical EEG applications). Use this one if you try to match EEGPrep and EEGLAB behavior specifically, for example when you migrate from a simple pipeline that uses the high-level EEGPrep preprocessor to a more custom pipeline built from individual steps and want to ensure identical results (up to float precision issues).
Resampling can be placed quite early in a preprocessing pipeline to cut down on compute time and memory usage of downstram steps, e.g., before filtering, but note the sampling rate interacts with e.g. temporal convolution kernel sizes; when reproducing literature, ideally you first resample to the same rate as used there.
Note
There can be a small timing accuracy penalty when resampling on continuous data (before epoching) when doing event-locked analysis, since epoch windows will be snapped to the nearest sample. However, this jitter is typically fairly minor relative to timing variability in the brain responses themselves, so will often not be a problem in practice.
- Parameters:
 sfreq (float | None) – The desired sampling rate in Hz. Skipped if set to None.
References
[Proakis2007]Proakis, J.G., 2007. Digital signal processing: principles, algorithms, and applications, 4/E. Pearson Education India.
Methods