braindecode.preprocessing.Resample#
- class braindecode.preprocessing.Resample(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:
- xndarray
Signal to resample.
- upfloat
Factor to upsample by.
- downfloat
Factor to downsample by.
- axisint
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; 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_jobsint | str
Number of jobs to run in parallel. Can be
'cuda'
ifcupy
is installed properly.n_jobs='cuda'
is only supported whenmethod="fft"
.- padstr
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'
.Added in version 0.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"
.- methodstr
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.Added in version 1.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.
- Returns:
- yarray
The x array resampled.
See more details in mne.filter.resample