Signal processing (scipy.signal
)#
Convolution#
|
Convolve two N-dimensional arrays. |
|
Cross-correlate two N-dimensional arrays. |
|
Convolve two N-dimensional arrays using FFT. |
|
Convolve two N-dimensional arrays using the overlap-add method. |
|
Convolve two 2-dimensional arrays. |
|
Cross-correlate two 2-dimensional arrays. |
|
Convolve with a 2-D separable FIR filter. |
|
Find the fastest convolution/correlation method. |
|
Calculates the lag / displacement indices array for 1D cross-correlation. |
B-splines#
|
Deprecated since version 1.11.0. |
|
Deprecated since version 1.11.0. |
|
Deprecated since version 1.11.0. |
|
Gaussian approximation to B-spline basis function of order n. |
|
Compute cubic spline coefficients for rank-1 array. |
|
Compute quadratic spline coefficients for rank-1 array. |
|
Coefficients for 2-D cubic (3rd order) B-spline. |
|
Coefficients for 2-D quadratic (2nd order) B-spline: |
|
Evaluate a cubic spline at the new set of points. |
|
Evaluate a quadratic spline at the new set of points. |
|
Smoothing spline (cubic) filtering of a rank-2 array. |
Filtering#
|
Perform an order filter on an N-D array. |
|
Perform a median filter on an N-dimensional array. |
|
Median filter a 2-dimensional array. |
|
Perform a Wiener filter on an N-dimensional array. |
|
Implement a smoothing IIR filter with mirror-symmetric boundary conditions using a cascade of first-order sections. The second section uses a reversed sequence. This implements a system with the following transfer function and mirror-symmetric boundary conditions::. |
|
Implement a smoothing IIR filter with mirror-symmetric boundary conditions using a cascade of second-order sections. The second section uses a reversed sequence. This implements the following transfer function::. |
|
Filter data along one-dimension with an IIR or FIR filter. |
|
Construct initial conditions for lfilter given input and output vectors. |
|
Construct initial conditions for lfilter for step response steady-state. |
|
Apply a digital filter forward and backward to a signal. |
|
Apply a Savitzky-Golay filter to an array. |
|
Deconvolves |
|
Filter data along one dimension using cascaded second-order sections. |
|
Construct initial conditions for sosfilt for step response steady-state. |
|
A forward-backward digital filter using cascaded second-order sections. |
|
Compute the analytic signal, using the Hilbert transform. |
|
Compute the '2-D' analytic signal of x |
|
Downsample the signal after applying an anti-aliasing filter. |
|
Remove linear trend along axis from data. |
|
Resample x to num samples using Fourier method along the given axis. |
|
Resample x along the given axis using polyphase filtering. |
|
Upsample, FIR filter, and downsample. |
Filter design#
|
Return a digital IIR filter from an analog one using a bilinear transform. |
|
Return a digital IIR filter from an analog one using a bilinear transform. |
|
Find array of frequencies for computing the response of an analog filter. |
|
FIR filter design using least-squares error minimization. |
|
FIR filter design using the window method. |
|
FIR filter design using the window method. |
|
Compute frequency response of analog filter. |
|
Compute frequency response of analog filter. |
|
Compute the frequency response of a digital filter. |
|
Compute the frequency response of a digital filter in ZPK form. |
|
Compute the frequency response of a digital filter in SOS format. |
|
Gammatone filter design. |
|
Compute the group delay of a digital filter. |
|
Complete IIR digital and analog filter design. |
|
IIR digital and analog filter design given order and critical points. |
|
Compute the attenuation of a Kaiser FIR filter. |
|
Compute the Kaiser parameter beta, given the attenuation a. |
|
Determine the filter window parameters for the Kaiser window method. |
|
Convert a linear-phase FIR filter to minimum phase |
|
Compute the coefficients for a 1-D Savitzky-Golay FIR filter. |
|
Calculate the minimax optimal filter using the Remez exchange algorithm. |
|
Determine unique roots and their multiplicities from a list of roots. |
|
Compute partial-fraction expansion of b(s) / a(s). |
|
Compute partial-fraction expansion of b(z) / a(z). |
|
Compute b(s) and a(s) from partial fraction expansion. |
|
Compute b(z) and a(z) from partial fraction expansion. |
Warning about badly conditioned filter coefficients |
Lower-level filter design functions:
|
Check state-space matrices and ensure they are 2-D. |
|
Band Stop Objective Function for order minimization. |
|
Return (z,p,k) for analog prototype of an Nth-order Bessel filter. |
|
Return (z,p,k) for analog prototype of Nth-order Butterworth filter. |
|
Return (z,p,k) for Nth-order Chebyshev type I analog lowpass filter. |
|
Return (z,p,k) for Nth-order Chebyshev type II analog lowpass filter. |
|
|
|
Return (z,p,k) of Nth-order elliptic analog lowpass filter. |
|
Transform a lowpass filter prototype to a bandpass filter. |
|
Transform a lowpass filter prototype to a bandpass filter. |
|
Transform a lowpass filter prototype to a bandstop filter. |
|
Transform a lowpass filter prototype to a bandstop filter. |
|
Transform a lowpass filter prototype to a highpass filter. |
|
Transform a lowpass filter prototype to a highpass filter. |
|
Transform a lowpass filter prototype to a different frequency. |
|
Transform a lowpass filter prototype to a different frequency. |
|
Normalize numerator/denominator of a continuous-time transfer function. |
Matlab-style IIR filter design#
|
Butterworth digital and analog filter design. |
|
Butterworth filter order selection. |
|
Chebyshev type I digital and analog filter design. |
|
Chebyshev type I filter order selection. |
|
Chebyshev type II digital and analog filter design. |
|
Chebyshev type II filter order selection. |
|
Elliptic (Cauer) digital and analog filter design. |
|
Elliptic (Cauer) filter order selection. |
|
Bessel/Thomson digital and analog filter design. |
|
Design second-order IIR notch digital filter. |
|
Design second-order IIR peak (resonant) digital filter. |
|
Design IIR notching or peaking digital comb filter. |
Continuous-time linear systems#
|
Continuous-time linear time invariant system base class. |
|
Linear Time Invariant system in state-space form. |
|
Linear Time Invariant system class in transfer function form. |
|
Linear Time Invariant system class in zeros, poles, gain form. |
|
Simulate output of a continuous-time linear system. |
|
Simulate output of a continuous-time linear system, by using the ODE solver |
|
Impulse response of continuous-time system. |
|
Impulse response of a single-input, continuous-time linear system. |
|
Step response of continuous-time system. |
|
Step response of continuous-time system. |
|
Calculate the frequency response of a continuous-time system. |
|
Calculate Bode magnitude and phase data of a continuous-time system. |
Discrete-time linear systems#
|
Discrete-time linear time invariant system base class. |
|
Linear Time Invariant system in state-space form. |
|
Linear Time Invariant system class in transfer function form. |
|
Linear Time Invariant system class in zeros, poles, gain form. |
|
Simulate output of a discrete-time linear system. |
|
Impulse response of discrete-time system. |
|
Step response of discrete-time system. |
|
Calculate the frequency response of a discrete-time system. |
|
Calculate Bode magnitude and phase data of a discrete-time system. |
LTI representations#
|
Return zero, pole, gain (z, p, k) representation from a numerator, denominator representation of a linear filter. |
|
Return second-order sections from transfer function representation |
|
Transfer function to state-space representation. |
|
Return polynomial transfer function representation from zeros and poles |
|
Return second-order sections from zeros, poles, and gain of a system |
|
Zero-pole-gain representation to state-space representation |
|
State-space to transfer function. |
|
State-space representation to zero-pole-gain representation. |
|
Return zeros, poles, and gain of a series of second-order sections |
|
Return a single transfer function from a series of second-order sections |
|
Transform a continuous to a discrete state-space system. |
|
Compute K such that eigenvalues (A - dot(B, K))=poles. |
Waveforms#
|
Frequency-swept cosine generator. |
|
Return a Gaussian modulated sinusoid: |
|
Maximum length sequence (MLS) generator. |
|
Return a periodic sawtooth or triangle waveform. |
|
Return a periodic square-wave waveform. |
|
Frequency-swept cosine generator, with a time-dependent frequency. |
|
Unit impulse signal (discrete delta function) or unit basis vector. |
Window functions#
For window functions, see the scipy.signal.windows
namespace.
In the scipy.signal
namespace, there is a convenience function to
obtain these windows by name:
|
Return a window of a given length and type. |
Wavelets#
|
Return (x, phi, psi) at dyadic points |
|
The coefficients for the FIR low-pass filter producing Daubechies wavelets. |
|
Complex Morlet wavelet. |
|
Return high-pass qmf filter from low-pass |
|
Return a Ricker wavelet, also known as the "Mexican hat wavelet". |
|
Complex Morlet wavelet, designed to work with |
|
Continuous wavelet transform. |
Peak finding#
|
Calculate the relative minima of data. |
|
Calculate the relative maxima of data. |
|
Calculate the relative extrema of data. |
|
Find peaks inside a signal based on peak properties. |
|
Find peaks in a 1-D array with wavelet transformation. |
|
Calculate the prominence of each peak in a signal. |
|
Calculate the width of each peak in a signal. |
Spectral analysis#
|
Estimate power spectral density using a periodogram. |
|
Estimate power spectral density using Welch's method. |
|
Estimate the cross power spectral density, Pxy, using Welch's method. |
|
Estimate the magnitude squared coherence estimate, Cxy, of discrete-time signals X and Y using Welch's method. |
|
Compute a spectrogram with consecutive Fourier transforms. |
|
Computes the Lomb-Scargle periodogram. |
|
Determine the vector strength of the events corresponding to the given period. |
|
Provide a parametrized discrete Short-time Fourier transform (stft) and its inverse (istft). |
|
Compute the Short Time Fourier Transform (STFT). |
|
Perform the inverse Short Time Fourier transform (iSTFT). |
|
Check whether the Constant OverLap Add (COLA) constraint is met. |
|
Check whether the Nonzero Overlap Add (NOLA) constraint is met. |
Chirp Z-transform and Zoom FFT#
|
Compute the frequency response around a spiral in the Z plane. |
|
Compute the DFT of x only for frequencies in range fn. |
|
Create a callable chirp z-transform function. |
|
Create a callable zoom FFT transform function. |
|
Return the points at which the chirp z-transform is computed. |
The functions are simpler to use than the classes, but are less efficient when using the same transform on many arrays of the same length, since they repeatedly generate the same chirp signal with every call. In these cases, use the classes to create a reusable function instead.