SciPy

Signal processing (scipy.signal)

Convolution

convolve(in1, in2[, mode]) Convolve two N-dimensional arrays.
correlate(in1, in2[, mode]) Cross-correlate two N-dimensional arrays.
fftconvolve(in1, in2[, mode]) Convolve two N-dimensional arrays using FFT.
convolve2d(in1, in2[, mode, boundary, fillvalue]) Convolve two 2-dimensional arrays.
correlate2d(in1, in2[, mode, boundary, ...]) Cross-correlate two 2-dimensional arrays.
sepfir2d((input, hrow, hcol) -> output) Description:

B-splines

bspline(x, n) B-spline basis function of order n.
cubic(x) A cubic B-spline.
quadratic(x) A quadratic B-spline.
gauss_spline(x, n) Gaussian approximation to B-spline basis function of order n.
cspline1d(signal[, lamb]) Compute cubic spline coefficients for rank-1 array.
qspline1d(signal[, lamb]) Compute quadratic spline coefficients for rank-1 array.
cspline2d((input {, lambda, precision}) -> ck) Description:
qspline2d((input {, lambda, precision}) -> qk) Description:
cspline1d_eval(cj, newx[, dx, x0]) Evaluate a spline at the new set of points.
qspline1d_eval(cj, newx[, dx, x0]) Evaluate a quadratic spline at the new set of points.
spline_filter(Iin[, lmbda]) Smoothing spline (cubic) filtering of a rank-2 array.

Filtering

order_filter(a, domain, rank) Perform an order filter on an N-dimensional array.
medfilt(volume[, kernel_size]) Perform a median filter on an N-dimensional array.
medfilt2d(input[, kernel_size]) Median filter a 2-dimensional array.
wiener(im[, mysize, noise]) Perform a Wiener filter on an N-dimensional array.
symiirorder1((input, c0, z1 {, ...) Implement a smoothing IIR filter with mirror-symmetric boundary conditions using a cascade of first-order sections.
symiirorder2((input, r, omega {, ...) Implement a smoothing IIR filter with mirror-symmetric boundary conditions using a cascade of second-order sections.
lfilter(b, a, x[, axis, zi]) Filter data along one-dimension with an IIR or FIR filter.
lfiltic(b, a, y[, x]) Construct initial conditions for lfilter.
lfilter_zi(b, a) Compute an initial state zi for the lfilter function that corresponds to the steady state of the step response.
filtfilt(b, a, x[, axis, padtype, padlen]) A forward-backward filter.
savgol_filter(x, window_length, polyorder[, ...]) Apply a Savitzky-Golay filter to an array.
deconvolve(signal, divisor) Deconvolves divisor out of signal.
hilbert(x[, N, axis]) Compute the analytic signal, using the Hilbert transform.
hilbert2(x[, N]) Compute the ‘2-D’ analytic signal of x
decimate(x, q[, n, ftype, axis]) Downsample the signal by using a filter.
detrend(data[, axis, type, bp]) Remove linear trend along axis from data.
resample(x, num[, t, axis, window]) Resample x to num samples using Fourier method along the given axis.

Filter design

bilinear(b, a[, fs]) Return a digital filter from an analog one using a bilinear transform.
findfreqs(num, den, N) Find an array of frequencies for computing the response of a filter.
firwin(numtaps, cutoff[, width, window, ...]) FIR filter design using the window method.
firwin2(numtaps, freq, gain[, nfreqs, ...]) FIR filter design using the window method.
freqs(b, a[, worN, plot]) Compute frequency response of analog filter.
freqz(b[, a, worN, whole, plot]) Compute the frequency response of a digital filter.
iirdesign(wp, ws, gpass, gstop[, analog, ...]) Complete IIR digital and analog filter design.
iirfilter(N, Wn[, rp, rs, btype, analog, ...]) IIR digital and analog filter design given order and critical points.
kaiser_atten(numtaps, width) Compute the attenuation of a Kaiser FIR filter.
kaiser_beta(a) Compute the Kaiser parameter beta, given the attenuation a.
kaiserord(ripple, width) Design a Kaiser window to limit ripple and width of transition region.
savgol_coeffs(window_length, polyorder[, ...]) Compute the coefficients for a 1-d Savitzky-Golay FIR filter.
remez(numtaps, bands, desired[, weight, Hz, ...]) Calculate the minimax optimal filter using the Remez exchange algorithm.
unique_roots(p[, tol, rtype]) Determine unique roots and their multiplicities from a list of roots.
residue(b, a[, tol, rtype]) Compute partial-fraction expansion of b(s) / a(s).
residuez(b, a[, tol, rtype]) Compute partial-fraction expansion of b(z) / a(z).
invres(r, p, k[, tol, rtype]) Compute b(s) and a(s) from partial fraction expansion.
invresz(r, p, k[, tol, rtype]) Compute b(z) and a(z) from partial fraction expansion.

Lower-level filter design functions:

abcd_normalize([A, B, C, D]) Check state-space matrices and ensure they are two-dimensional.
band_stop_obj(wp, ind, passb, stopb, gpass, ...) Band Stop Objective Function for order minimization.
besselap(N) Return (z,p,k) for analog prototype of an Nth order Bessel filter.
buttap(N) Return (z,p,k) for analog prototype of Nth order Butterworth filter.
cheb1ap(N, rp) Return (z,p,k) for Nth order Chebyshev type I analog lowpass filter.
cheb2ap(N, rs) Return (z,p,k) for Nth order Chebyshev type I analog lowpass filter.
cmplx_sort(p) Sort roots based on magnitude.
ellipap(N, rp, rs) Return (z,p,k) of Nth order elliptic analog lowpass filter.
lp2bp(b, a[, wo, bw]) Transform a lowpass filter prototype to a bandpass filter.
lp2bs(b, a[, wo, bw]) Transform a lowpass filter prototype to a bandstop filter.
lp2hp(b, a[, wo]) Transform a lowpass filter prototype to a highpass filter.
lp2lp(b, a[, wo]) Transform a lowpass filter prototype to a different frequency.
normalize(b, a) Normalize polynomial representation of a transfer function.

Matlab-style IIR filter design

butter(N, Wn[, btype, analog, output]) Butterworth digital and analog filter design.
buttord(wp, ws, gpass, gstop[, analog]) Butterworth filter order selection.
cheby1(N, rp, Wn[, btype, analog, output]) Chebyshev type I digital and analog filter design.
cheb1ord(wp, ws, gpass, gstop[, analog]) Chebyshev type I filter order selection.
cheby2(N, rs, Wn[, btype, analog, output]) Chebyshev type II digital and analog filter design.
cheb2ord(wp, ws, gpass, gstop[, analog]) Chebyshev type II filter order selection.
ellip(N, rp, rs, Wn[, btype, analog, output]) Elliptic (Cauer) digital and analog filter design.
ellipord(wp, ws, gpass, gstop[, analog]) Elliptic (Cauer) filter order selection.
bessel(N, Wn[, btype, analog, output]) Bessel/Thomson digital and analog filter design.

Continuous-Time Linear Systems

freqresp(system[, w, n]) Calculate the frequency response of a continuous-time system.
lti(*args, **kwords) Linear Time Invariant class which simplifies representation.
lsim(system, U, T[, X0, interp]) Simulate output of a continuous-time linear system.
lsim2(system[, U, T, X0]) Simulate output of a continuous-time linear system, by using the ODE solver scipy.integrate.odeint.
impulse(system[, X0, T, N]) Impulse response of continuous-time system.
impulse2(system[, X0, T, N]) Impulse response of a single-input, continuous-time linear system.
step(system[, X0, T, N]) Step response of continuous-time system.
step2(system[, X0, T, N]) Step response of continuous-time system.
bode(system[, w, n]) Calculate Bode magnitude and phase data of a continuous-time system.

Discrete-Time Linear Systems

dlsim(system, u[, t, x0]) Simulate output of a discrete-time linear system.
dimpulse(system[, x0, t, n]) Impulse response of discrete-time system.
dstep(system[, x0, t, n]) Step response of discrete-time system.

LTI Representations

tf2zpk(b, a) Return zero, pole, gain (z,p,k) representation from a numerator, denominator representation of a linear filter.
zpk2tf(z, p, k) Return polynomial transfer function representation from zeros
tf2ss(num, den) Transfer function to state-space representation.
ss2tf(A, B, C, D[, input]) State-space to transfer function.
zpk2ss(z, p, k) Zero-pole-gain representation to state-space representation
ss2zpk(A, B, C, D[, input]) State-space representation to zero-pole-gain representation.
cont2discrete(sys, dt[, method, alpha]) Transform a continuous to a discrete state-space system.

Waveforms

chirp(t, f0, t1, f1[, method, phi, vertex_zero]) Frequency-swept cosine generator.
gausspulse(t[, fc, bw, bwr, tpr, retquad, ...]) Return a Gaussian modulated sinusoid:
max_len_seq(nbits[, state, length, taps]) Maximum Length Sequence (MLS) generator
sawtooth(t[, width]) Return a periodic sawtooth or triangle waveform.
square(t[, duty]) Return a periodic square-wave waveform.
sweep_poly(t, poly[, phi]) Frequency-swept cosine generator, with a time-dependent frequency.

Window functions

get_window(window, Nx[, fftbins]) Return a window.
barthann(M[, sym]) Return a modified Bartlett-Hann window.
bartlett(M[, sym]) Return a Bartlett window.
blackman(M[, sym]) Return a Blackman window.
blackmanharris(M[, sym]) Return a minimum 4-term Blackman-Harris window.
bohman(M[, sym]) Return a Bohman window.
boxcar(M[, sym]) Return a boxcar or rectangular window.
chebwin(M, at[, sym]) Return a Dolph-Chebyshev window.
cosine(M[, sym]) Return a window with a simple cosine shape.
flattop(M[, sym]) Return a flat top window.
gaussian(M, std[, sym]) Return a Gaussian window.
general_gaussian(M, p, sig[, sym]) Return a window with a generalized Gaussian shape.
hamming(M[, sym]) Return a Hamming window.
hann(M[, sym]) Return a Hann window.
kaiser(M, beta[, sym]) Return a Kaiser window.
nuttall(M[, sym]) Return a minimum 4-term Blackman-Harris window according to Nuttall.
parzen(M[, sym]) Return a Parzen window.
slepian(M, width[, sym]) Return a digital Slepian (DPSS) window.
triang(M[, sym]) Return a triangular window.

Wavelets

cascade(hk[, J]) Return (x, phi, psi) at dyadic points K/2**J from filter coefficients.
daub(p) The coefficients for the FIR low-pass filter producing Daubechies wavelets.
morlet(M[, w, s, complete]) Complex Morlet wavelet.
qmf(hk) Return high-pass qmf filter from low-pass
ricker(points, a) Return a Ricker wavelet, also known as the “Mexican hat wavelet”.
cwt(data, wavelet, widths) Continuous wavelet transform.

Peak finding

find_peaks_cwt(vector, widths[, wavelet, ...]) Attempt to find the peaks in a 1-D array.
argrelmin(data[, axis, order, mode]) Calculate the relative minima of data.
argrelmax(data[, axis, order, mode]) Calculate the relative maxima of data.
argrelextrema(data, comparator[, axis, ...]) Calculate the relative extrema of data.

Spectral Analysis

periodogram(x[, fs, window, nfft, detrend, ...]) Estimate power spectral density using a periodogram.
welch(x[, fs, window, nperseg, noverlap, ...]) Estimate power spectral density using Welch’s method.
lombscargle(x, y, freqs) Computes the Lomb-Scargle periodogram.
vectorstrength(events, period) Determine the vector strength of the events corresponding to the given period.