Expand description
Signal-processing utilities following scipy.signal: filter analysis (group_delay,
minimum_phase), least-squares FIR design (firls), rate changes (decimate and the
FFT resample), medfilt, the amplitude envelope, and cross-spectral analysis
(csd, coherence).
See the book entry Signal-processing utilities.
Structs§
- Cross
Spectrum - A one-sided cross spectral density estimate.
Functions§
- coherence
- The magnitude-squared coherence
|P_xy|² / (P_xx P_yy)(SciPy’scoherence): 1 whereyis a noise-free linear filtering ofx, near 0 where they are unrelated. - csd
- The cross spectral density
P_xy(f)by Welch’s method (SciPy’scsd): segments ofwindow.len()samples overlapping byoverlap, detrended and windowed; the average ofconj(X) Y, scaled aswelchand doubled except at DC and an even-length Nyquist bin. - decimate
- Downsampling by an integer factor
qafter anti-alias filtering (SciPy’sdecimatewithftype='iir'): an order-8 Chebyshev type I lowpass with 0.05 dB ripple and cutoff0.8/qof Nyquist, applied forwards and backwards (zero_phase) or forwards only, then everyq-th sample. - envelope
- The amplitude envelope
|x + i H{x}|, the magnitude of the analytic signal (equal to SciPy’sabs(hilbert(x))). - firls
- A linear-phase FIR filter of odd length
numtapsminimising the weighted integrated squared error to a piecewise-linear desired response (SciPy’sfirls).bandsholds band edges in pairs anddesiredthe gains at those edges, as fractions of the Nyquist frequency whenfsisNone. - group_
delay - The group delay
−dφ/dωof the filterb(z)/a(z)in samples at the normalised angular frequenciesw(radians per sample) (SciPy’sgroup_delay). Withc = b ∗ reverse(conj(a)),τ(ω) = Re(Σ k cₖ e^{−iωk} / Σ cₖ e^{−iωk}) − (len(a) − 1); at frequencies where the denominator vanishes the delay is set to 0, as in SciPy. - medfilt
- A median filter with an odd
kernel_size, the signal extended by zeros (SciPy’smedfilt). - minimum_
phase - A minimum-phase FIR filter from a linear-phase one by the homomorphic method (SciPy’s
minimum_phase(h, 'homomorphic')): the real cepstrum of|H|(or of|H|^{1/2}withhalf, which preserves the magnitude of a filter that is the square of a minimum-phase one), folded onto positive quefrencies and exponentiated back. Returnslen(h)/2 + len(h) mod 2coefficients withhalf, otherwiselen(h). - resample
- Resamples the real signal
xtonumsamples by the FFT (SciPy’sresample): the spectrum is truncated or zero-padded, with the unpaired Nyquist bin of an even length united when downsampling and split when upsampling. Exact for band-limited periodic signals. - zoom_
fft - The DFT of
xatmequally spaced frequencies fromf1towardsf2(SciPy’szoom_fft, with the sample ratefs): the chirp z-transform on an arc of the unit circle starting ata = e^{2πi f1/fs}with ratiow = e^{−2πi (f2 − f1)/(fs m)}((m − 1)in place ofmwithendpoint), computed by Bluestein’s algorithm inO((n + m) log(n + m)).