mne.filter.resample#
- 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.
- Parameters:
- x
ndarray
Signal to resample.
- up
float
Factor to upsample by.
- down
float
Factor to downsample by.
- axis
int
Axis along which to resample (default is the last axis).
- window
str
|tuple
When
method="fft"
, this is the frequency-domain window to use in resampling, and should be the same length as the signal; seescipy.signal.resample()
for details. Whenmethod="polyphase"
, this is the time-domain linear-phase window to use after upsampling the signal; seescipy.signal.resample_poly()
for details. The default"auto"
will use"boxcar"
formethod="fft"
and("kaiser", 5.0)
formethod="polyphase"
.- n_jobs
int
|str
Number of jobs to run in parallel. Can be
'cuda'
ifcupy
is installed properly.n_jobs='cuda'
is only supported whenmethod="fft"
.- pad
str
The type of padding to use. When
method="fft"
, supports allnumpy.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. Whenmethod="polyphase"
, supports all modes ofscipy.signal.upfirdn()
. The default (“auto”) means'reflect_limited'
formethod='fft'
and'reflect'
formethod='polyphase'
.New in v0.15.
- npad
int
|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"
.- method
str
Resampling method to use. Can be
"fft"
(default) or"polyphase"
to use FFT-based on polyphase FIR resampling, respectively. These wrap toscipy.signal.resample()
andscipy.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 andmne.verbose()
for details. Should only be passed as a keyword argument.
- x
- Returns:
- y
array
The x array resampled.
- y
Notes
When using
method="fft"
(default), this uses (hopefully) intelligent edge padding and frequency-domain windowing improvescipy.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
Receptive Field Estimation and Prediction