Wavelet Transforms in Python — PyWavelets Documentation (original) (raw)

Contents#

PyWavelets is open source wavelet transform software for Python. It combines a simple high level interface with low level C and Cython performance.

PyWavelets is very easy to use and get started with. Just install the package, open the Python interactive shell and type:

import pywt cA, cD = pywt.dwt([1, 2, 3, 4], 'db1')

Voilà! Computing wavelet transforms has never been so simple :)

Here is a slightly more involved example of applying a digital wavelet transform to an image:

import matplotlib.pyplot as plt import numpy as np

import pywt import pywt.data

Load image

original = pywt.data.camera()

Wavelet transform of image, and plot approximation and details

titles = ['Approximation', ' Horizontal detail', 'Vertical detail', 'Diagonal detail'] coeffs2 = pywt.dwt2(original, 'bior1.3') LL, (LH, HL, HH) = coeffs2 fig = plt.figure(figsize=(12, 3)) for i, a in enumerate([LL, LH, HL, HH]): ax = fig.add_subplot(1, 4, i + 1) ax.imshow(a, interpolation="nearest", cmap=plt.cm.gray) ax.set_title(titles[i], fontsize=10) ax.set_xticks([]) ax.set_yticks([])

fig.tight_layout() plt.show()

_images/camera_approx_detail.png

Main features#

The main features of PyWavelets are:

Getting help#

Use GitHub Issues, StackOverflow, or the PyWavelets discussions groupto post your comments or questions.

License#

PyWavelets is a free Open Source software released under the MIT license.

Citing#

If you use PyWavelets in a scientific publication, we would appreciate citations of the project via the following JOSS publication:

Gregory R. Lee, Ralf Gommers, Filip Wasilewski, Kai Wohlfahrt, Aaron O’Leary (2019). PyWavelets: A Python package for wavelet analysis. Journal of Open Source Software, 4(36), 1237, https://doi.org/10.21105/joss.01237.

http://joss.theoj.org/papers/10.21105/joss.01237/status.svg

Specific releases can also be cited via Zenodo. The DOI below will correspond to the most recent release. DOIs for past versions can be found by following the link in the badge below to Zenodo:

https://zenodo.org/badge/DOI/10.5281/zenodo.1407171.svg