Chapter Summary
Chapter Summary
Key Points
- 1.
The FFT is your most important tool.
np.fft.fftcomputes the DFT in operations. Usefftfreqfor the frequency axis,fftshiftfor centered spectra, and always match thenormargument between forward and inverse transforms. Zero-padding interpolates the spectrum but does not improve resolution — resolution depends on the observation duration . - 2.
Choose the right filter type. FIR filters (
firwin,remez) are always stable and can have exactly linear phase. IIR filters (butter,cheby1) achieve steeper rolloff with fewer coefficients but can be unstable and have nonlinear phase. Always use the SOS representation (output='sos') for IIR filters to avoid numerical instability from high-order polynomials. - 3.
Window before you FFT. The rectangular window has only dB sidelobe suppression. Use Hann for general-purpose analysis, Blackman for high dynamic range, or Kaiser for a configurable trade-off. Use Welch's method (
scipy.signal.welch) instead of the raw periodogram for smoother PSD estimates with controlled variance. - 4.
Resample with awareness.
resample(FFT-based) assumes periodicity; preferresample_polyfor non-periodic signals. For smooth interpolation of irregularly-spaced data, useCubicSpline. For multi-dimensional regular grids, useRegularGridInterpolator. Always apply anti-aliasing before downsampling. - 5.
Wavelets adapt where Fourier cannot. The DWT provides adaptive time-frequency resolution — short windows at high frequencies, long windows at low frequencies. Wavelet denoising with soft thresholding is near-optimal for piecewise-smooth signals. Use
pywt.wavedec/waverecfor the DWT andpywt.cwtfor scalogram visualization.
Looking Ahead
Chapter 8 applies the optimization tools in SciPy to solve minimization, root-finding, and curve-fitting problems. Many signal processing tasks — like adaptive filtering, spectral estimation, and compressed sensing — are optimization problems in disguise. The FFT and filter design tools from this chapter will reappear as building blocks in those formulations.