PyWavelets 0.5.0 Release Notes

PyWavelets is a Python toolbox implementing both discrete and continuous wavelet transforms (mathematical time-frequency transforms) with a wide range of built-in wavelets. C/Cython are used for the low-level routines, enabling high performance. Key Features of PyWavelets are:

  • 1D, 2D and nD Forward and Inverse Discrete Wavelet Transform (DWT and IDWT)
  • 1D, 2D and nD Multilevel DWT and IDWT
  • 1D and 2D Forward and Inverse Stationary Wavelet Transform
  • 1D and 2D Wavelet Packet decomposition and reconstruction
  • 1D Continuous Wavelet Transform
  • When multiple valid implementations are available, we have chosen to maintain consistency with MATLAB™‘s Wavelet Toolbox.

PyWavelets 0.5.0 is the culmination of 1 year of work. In addition to several new features, substantial refactoring of the underlying C and Cython code have been made.

This release requires Python 2.6, 2.7 or 3.3-3.5 and NumPy 1.9.1 or greater. This will be the final release supporting Python 2.6 and 3.3.

Highlights of this release include:

  • 1D continuous wavelet transforms
  • new discrete wavelets added (additional Debauchies and Coiflet wavelets)
  • new ‘reflect’ extension mode for discrete wavelet transforms
  • faster performance for multilevel forward stationary wavelet transforms (SWT)
  • n-dimensional support added to forward SWT
  • routines to convert multilevel DWT coefficients to and from a single array
  • axis support for multilevel DWT
  • substantial refactoring/reorganization of the underlying C and Cython code

New features

1D Continous Wavelet Transforms

A wide range of continous wavelets are now available. These include the following:

  • Gaussian wavelets (gaus1...``gaus8``)
  • Mexican hat wavelet (mexh)
  • Morlet wavelet (morl)
  • Complex Gaussian wavelets (cgau1...``cgau8``)
  • Shannon wavelet (shan)
  • Frequency B-Spline wavelet (fbsp)
  • Complex Morlet wavelet (cmor)

Also, see the new CWT-related demo: demo/cwt_analysis.py

New discrete wavelets

Additional Debauchies wavelets (db20...``db38``) and Coiflets (coif6...``coif17``) have been added.

New extension mode: reflect

Discrete wavelet transforms support a new extension mode, reflect. This mode pads an array symmetrically, but without repeating the edge value. As an example:

 pad      array      pad
4 3 2 | 1 2 3 4 5 | 4 3 2

This differs from symmetric, which repeats the values at the boundaries:

 pad      array      pad
3 2 1 | 1 2 3 4 5 | 5 4 3

Multilevel DWT Coefficient Handling

New routines to convert the coefficients returned by multilevel DWT routines to and from a single n-dimensional array have been added. pywt.coeffs_to_array concatenates the output of wavedec, wavedec2 or wavedecn into a single numpy array. pywt.array_to_coeffs can be used to transform back from a single coefficient array to a format appropriate for waverec, waverec2 or waverecn.

More C function calls release the GIL

Cython code calling the wavelet filtering routines (DWT and SWT) now releases the global interpreter lock (GIL) where possible. A potential use case is in speeding up the batch computation of several large DWTs using multi-threading (e.g. via concurrent.futures).

Multilevel wavelet transforms along specific axes

The axis specific transform support introduced in the prior release was extended to the multilevel DWT transforms. All wavedec* and waverec* routines have a new axis (1D) or axes (2D, nD) keyword argument. If unspecified the default behaviour is to transform all axes of the input.

Faster multilevel stationary wavelet transforms

Stationary wavelet transforms are now faster when the number of levels is greater than one. The improvement can be very large (multiple orders of magnitude) for transforms with a large number of levels.

Backwards incompatible changes

A FutureWarning was added to swt2 and iswt2 to warn about a pending backwards incompatible change to the order of the coefficients in the list returned by these routines. The actual change will not occur until the next release. Transform coefficients will be returned in descending rather than ascending order. This change is being made for consistency with all other existing multi-level transforms in PyWavelets.

Bugs Fixed

demo/image_blender.py was updated to support the new api of Pillow 3.x

A bug related to size of assumed size_t on some platforms/compilers (e.g. Windows with mingw64) was fixed.

Fix to memory leak in (i)dwt_axis

Fix to a performance regression in idwt and iswt that was introduced in v0.4.0.

Fixed a bug in dwtn and idwtn for data with complex dtype when axes != None.

Other changes

The minimum supported numpy version has been increased to 1.9.1.

Test coverage (including for the Cython and C code) via Codecov was added and the overall test coverage has been improved.

A substantial overhaul of the C extension code has been performed. Custom templating is no longer used. The intention is to make this code easier to maintain and expand in the future.

The Cython code has been split out into a multiple files to hopefully make relevant portions of the wrappers easier to find for future developers.

setup.py now relies on setuptools in all cases (rather than distutils).

Authors

  • Jonathan Dan +
  • Ralf Gommers
  • David Menéndez Hurtado
  • Gregory R. Lee
  • Holger Nahrstaedt +
  • Daniel M. Pelt +
  • Alexandre Saint +
  • Scott Sievert +
  • Kai Wohlfahrt
  • Frank Yu +

A total of 10 people contributed to this release. People with a “+” by their names contributed a patch for the first time. This list of names is automatically generated, and may not be fully complete.

Issues closed for v0.5.0

  • #48: Continous wavelet transform?
  • #127: Reorganize _pywt
  • #160: Appveyor failing on recent PRs
  • #163: Set up coveralls
  • #166: Wavelet coefficients to single array (and vice versa?)
  • #177: Fail to install pywt due to the use of index_t which conflict with the defination in /usr/include/sys/types.h on smartos sysmte(open solaris like system)
  • #180: Memory leak
  • #187: ‘reflect’ signal extension mode
  • #189: bump minimum numpy version?
  • #191: Upgrade removed Pillow methods
  • #196: building in-place for development.
  • #200: swt implementation is considerably slower than MATLAB
  • #209: broken doctests
  • #210: Run doctests in CI setup
  • #211: Typo in iswt documentation
  • #217: blank_discrete_wavelet does not properly intiailize some properties
  • #231: I can’t compile pywt

Pull requests for v0.5.0

  • #148: Reorganize C v2
  • #161: Remove numpy distutils
  • #162: fix: iswt/idwt performance regression
  • #164: Improved coefficients for db and coif
  • #167: Add coverage (codecov.io)
  • #168: convert transform coefficients to and from a single n-dimensional array
  • #169: Remove templating
  • #170: :Always install new pip on Appveyor
  • #172: Adding of missing wavelets from the matlab list
  • #178: use Index_t instead of index_t
  • #179: add axis/axes support to multilevel discrete wavelet transforms
  • #181: Fix memory leak
  • #182: improve test coverage for _multidim.py and _multilevel.py
  • #183: improve coverage for _dwt.py
  • #184: fix corner case in coeffs_to_array
  • #188: Drop GIL in c_wt calls
  • #190: bump minimum numpy to 1.9
  • #192: Upgrade to Pillow>=3 api
  • #193: ENH: add ‘reflect’ extension mode
  • #197: BLD: fix “python setup.py develop”. Closes gh-196
  • #198: Choose clz* based on SIZE_MAX
  • #201: speedup multi-level swt
  • #205: fix dwtn/idwtn with axes != None and complex data
  • #206: DOC: correct typo in iswt docstring
  • #207: minor documentation updates
  • #208: document coeff_to_array and array_to_coeff
  • #214: FIX: update several doctests to reflect the new wavelets added
  • #218: FIX: initialize all properties of a blank discrete wavelet
  • #219: document coordinate conventions for 2D DWT routines.
  • #220: Run doctests on TravisCI
  • #221: Documentation for cwt and ContinuousWavelet
  • #222: consistent use of double backticks in docs
  • #223: add FutureWarning about swt2 coefficient order
  • #224: n-dimensional stationary wavelet transform (swtn) and axis support in swt, swt2
  • #225: BUG: fix breakage on 32-bit Python.
  • #226: DOC: update Copyright statements.
  • #227: ENH: add kind keyword to wavelist()
  • #228: MAINT: avoid using a builtin as variable name in qmf().
  • #229: DOC: add swtn, iswt, iswt2 to the API documentation
  • #230: add demo of batch processing via concurrent.futures
  • #234: ENH: coeffs_to_array supports axes argument as recently added to wavedec*
  • #236: BLD: raise an ImportError if Cython should be installed but isn’t.