scipy.signal.decimate¶
- scipy.signal.decimate(x, q, n=None, ftype='iir', axis=-1, zero_phase=None)[source]¶
Downsample the signal after applying an anti-aliasing filter.
By default, an order 8 Chebyshev type I filter is used. A 30 point FIR filter with Hamming window is used if ftype is ‘fir’.
Parameters: x : ndarray
The signal to be downsampled, as an N-dimensional array.
q : int
The downsampling factor. For downsampling factors higher than 13, it is recommended to call decimate multiple times.
n : int, optional
The order of the filter (1 less than the length for ‘fir’). Defaults to 8 for ‘iir’ and 30 for ‘fir’.
ftype : str {‘iir’, ‘fir’} or lti instance, optional
If ‘iir’ or ‘fir’, specifies the type of lowpass filter. If an instance of an lti object, uses that object to filter before downsampling.
axis : int, optional
The axis along which to decimate.
zero_phase : bool, optional
Prevent phase shift by filtering with filtfilt instead of lfilter when using an IIR filter, and shifting the outputs back by the filter’s group delay when using an FIR filter. A value of True is recommended, since a phase shift is generally not desired. Using None defaults to False for backwards compatibility. This default will change to True in a future release, so it is best to set this argument explicitly.
New in version 0.18.0.
Returns: y : ndarray
The down-sampled signal.
See also
- resample
- Resample up or down using the FFT method.
- resample_poly
- Resample using polyphase filtering and an FIR filter.
Notes
The zero_phase keyword was added in 0.18.0. The possibility to use instances of lti as ftype was added in 0.18.0.