Applying the discrete wavelet transform

The discrete wavelet transform (DWT) captures information in both the time and frequency domains. The mathematician Alfred Haar created the first wavelet. We will use this Haar wavelet in this recipe too. The transform returns approximation and detail coefficients, which we need to use together to get the original signal back. The approximation coefficients are the result of a low-pass filter. A high-pass filter produces the detail coefficients. The Haar wavelet algorithm is of order O(n) and, similar to the STFT algorithm (refer to the Analyzing the frequency spectrum of audio recipe), combines frequency and time information.

The difference with the Fourier transform is that we express the signal as a sum ...

Get Python Data Analysis Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.