mne.filter.resample

mne.filter.resample(x, up=1.0, down=1.0, npad=100, axis=-1, window='boxcar', n_jobs=1, pad='reflect_limited', verbose=None)[source]

Resample an array.

Operates along the last dimension of the array.

Parameters:
x : n-d array

Signal to resample.

up : float

Factor to upsample by.

down : float

Factor to downsample by.

npad : int | str

Number of samples to use at the beginning and end for padding. Can be “auto” to pad to the next highest power of 2.

axis : int

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

window : string or tuple

See scipy.signal.resample() for description.

n_jobs : int | str

Number of jobs to run in parallel. Can be ‘cuda’ if cupy is installed properly.

pad : str

The type of padding to use. Supports all numpy.pad() mode options. Can also be “reflect_limited” (default), which pads with a reflected version of each vector mirrored on the first and last values of the vector, followed by zeros.

New in version 0.15.

verbose : bool, str, int, or None

If not None, override default verbose level (see mne.verbose() and Logging documentation for more).

Returns:
xf : array

x resampled.

Notes

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.

Resampling arguments are broken into “up” and “down” components for future compatibility in case we decide to use an upfirdn implementation. The current implementation is functionally equivalent to passing up=up/down and down=1.