Wavelet plot with Python libraries


I know that SciPy has some signal processing tools for wavelets in scipy.signal.wavelets and a chart can be drawn using Matplotlib, but it seems I can't get it right. I have tried plotting a Daubechies wavelet against a linear space, but it's not what I am looking for. I am highly unskilled about wavelets and math in general . :)

11/25/2013 10:20:36 AM

Accepted Answer

With a recent trunk version of PyWavelets, getting approximations of scaling function and wavelet function on x-grid is pretty straightforward:

[phi, psi, x] = pywt.Wavelet('db2').wavefun(level=4)

Note that x-grid output is not available in v0.1.6, so if you need that you will have to use the trunk version.

Having that data, you can plot it using your favourite plotting package, for example:

import pylab
pylab.plot(x, psi)

A very similar method is used on wavelets.pybytes.com demo page, but there the charts are done with Google Charts for online presentation.

7/13/2009 10:03:00 AM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow