mne.filter.resample(x, up=1.0, down=1.0, *, axis=-1, window='auto', n_jobs=None, pad='auto', npad=100, method='fft', verbose=None)[source]#

Resample an array.

Operates along the last dimension of the array.


Signal to resample.


Factor to upsample by.


Factor to downsample by.


Axis along which to resample (default is the last axis).

windowstr | tuple

When method="fft", this is the frequency-domain window to use in resampling, and should be the same length as the signal; see scipy.signal.resample() for details. When method="polyphase", this is the time-domain linear-phase window to use after upsampling the signal; see scipy.signal.resample_poly() for details. The default "auto" will use "boxcar" for method="fft" and ("kaiser", 5.0) for method="polyphase".

n_jobsint | str

Number of jobs to run in parallel. Can be 'cuda' if cupy is installed properly. n_jobs='cuda' is only supported when method="fft".


The type of padding to use. When method="fft", supports all numpy.pad() mode options. Can also be "reflect_limited", which pads with a reflected version of each vector mirrored on the first and last values of the vector, followed by zeros. When method="polyphase", supports all modes of scipy.signal.upfirdn(). The default (“auto”) means 'reflect_limited' for method='fft' and 'reflect' for method='polyphase'.

New in v0.15.

npadint | str

Amount to pad the start and end of the data. Can also be "auto" to use a padding that will result in a power-of-two size (can be much faster).

Only used when method="fft".


Resampling method to use. Can be "fft" (default) or "polyphase" to use FFT-based on polyphase FIR resampling, respectively. These wrap to scipy.signal.resample() and scipy.signal.resample_poly(), respectively.

New in v1.7.

verbosebool | str | int | None

Control verbosity of the logging output. If None, use the default verbosity level. See the logging documentation and mne.verbose() for details. Should only be passed as a keyword argument.


The x array resampled.


When using method="fft" (default), this uses (hopefully) intelligent edge padding and frequency-domain windowing improve scipy.signal.resample()’s resampling method, which we have adapted for our use here. Choices of npad and window have important consequences, and the default choices should work well for most natural signals.

Examples using mne.filter.resample#

Spectro-temporal receptive field (STRF) estimation on continuous data

Spectro-temporal receptive field (STRF) estimation on continuous data

Receptive Field Estimation and Prediction

Receptive Field Estimation and Prediction