v2.0.0
Loading...
Searching...
No Matches
resample.h File Reference

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

#include "dsp_global.h"
#include <Eigen/Core>
Include dependency graph for resample.h:
This graph shows which files directly or indirectly include this file:

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).

Detailed Description

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

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors

Author
Christoph Dinh chris.nosp@m.toph.nosp@m..dinh.nosp@m.@mne.nosp@m.-cpp..nosp@m.org
Since
2.1.0
Date
March 2026

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.