# `mlpy.wavelet` - Wavelet Transform

## Padding

## Discrete Wavelet Transform

Discrete Wavelet Transform based on the GSL DWT [Gsldwt].

For the forward transform, the output is the discrete wavelet transform f_i \rightarrow w_{j,k} in a packed triangular storage layout, where j is the index of the level j = 0 \dots J-1 and k is the index of the coefficient within each level, k = 0 \dots (2^j)-1. The total number of levels is J = \log_2(n). The output data has the following form,

(s_{-1,0}, d_{0,0}, d_{1,0}, d_{1,1}, d_{2,0}, \dots, d_{j,k}, ..., d_{J-1,2^{J-1}-1})

where the first element is the smoothing coefficient s_{-1,0}, followed by the detail coefficients d_{j,k} for each level j. The backward transform inverts these coefficients to obtain the original data.

Note

from GSL online manual (http://www.gnu.org/software/gsl/manual/)

## Undecimated Wavelet Transform

Undecimated Wavelet Transform (also known as stationary wavelet transform, redundant wavelet transform, translation invariant wavelet transform, shift invariant wavelet transform or Maximal overlap wavelet transform) based on the “wavelets” R package.

## Continuous Wavelet Transform

Continuous Wavelet Transform based on [Torrence98].

Torrence98

  C Torrence and G P Compo. Practical Guide to Wavelet Analysis

Gsldwt

  Gnu Scientific Library, http://www.gnu.org/software/gsl/

Example (requires matplotlib)

    >>> import numpy as np
    >>> import matplotlib.pyplot as plt
    >>> import mlpy.wavelet as wave
    >>> x = np.random.sample(512)
    >>> scales = wave.autoscales(N=x.shape[0], dt=1, dj=0.25, wf='dog', p=2)
    >>> X = wave.cwt(x=x, dt=1, scales=scales, wf='dog', p=2)
    >>> fig = plt.figure(1)
    >>> ax1 = plt.subplot(2,1,1)
    >>> p1 = ax1.plot(x)
    >>> ax1.autoscale_view(tight=True)
    >>> ax2 = plt.subplot(2,1,2)
    >>> p2 = ax2.imshow(np.abs(X), interpolation='nearest')
    >>> plt.show()