Declaration of Resample — polyphase anti-aliased rational resampling for MEG/EEG data. More...


Go to the source code of this file.
Classes | |
| class | UTILSLIB::Resample |
| Polyphase anti-aliased rational resampling for MEG/EEG data. More... | |
Namespaces | |
| namespace | UTILSLIB |
| Shared utilities (I/O helpers, spectral analysis, layout management, warp algorithms). | |
Declaration of Resample — polyphase anti-aliased rational resampling for MEG/EEG data.
SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors
Algorithm: Given input rate oldSFreq and target rate newSFreq, the rational ratio p/q is computed after GCD reduction. An anti-aliasing low-pass FIR is built using a Hamming-windowed sinc with cutoff = min(p,q) / (2·max(p,q)) (as a fraction of the upsampled Nyquist). The filter is evaluated lazily via the polyphase identity:
y[m] = p · Σ_j h[m·q − j·p] · x[j]
where the summation is restricted to j values for which the tap index m·q − j·p lies in [0, L−1]. No explicit upsampling (inserting p−1 zeros) is performed.
The filter delay (halfLen = nZeros · max(p,q) samples at the upsampled rate) is absorbed into the output indexing so that the first output sample corresponds to the first input sample.
Reference: similar approach to scipy.signal.resample_poly.
Definition in file resample.h.