Multiresolution Analysis

The functions in this module can be used to project a signal onto wavelet subspaces and an approximation subspace. This is an additive decomposition such that the sum of the coefficients equals the original signal. The projected signal coefficients remains temporally aligned with the original, regardless of the symmetry of the wavelet used for the analysis.

Multilevel 1D mra

pywt.mra(data, wavelet, level=None, axis=-1, transform='swt', mode='periodization')

Forward 1D multiresolution analysis.

It is a projection onto the wavelet subspaces.

Parameters
data: array_like

Input data

waveletWavelet object or name string

Wavelet to use

levelint, optional

Decomposition level (must be >= 0). If level is None (default) then it will be calculated using the dwt_max_level function.

axis: int, optional

Axis over which to compute the DWT. If not given, the last axis is used. Currently only available when transform='dwt'.

transform{‘dwt’, ‘swt’}

Whether to use the DWT or SWT for the transforms.

modestr, optional

Signal extension mode, see Modes (default: ‘symmetric’). This option is only used when transform=’dwt’.

Returns
[cAn, {details_level_n}, … {details_level_1}]list

For more information, see the detailed description in wavedec

See also

imra, swt

Notes

This is sometimes referred to as an additive decomposition because the inverse transform (imra) is just the sum of the coefficient arrays [1]. The decomposition using transform='dwt' corresponds to section 2.2 while that using an undecimated transform (transform='swt') is described in section 3.2 and appendix A.

This transform does not share the variance partition property of swt with norm=True. It does however, result in coefficients that are temporally aligned regardless of the symmetry of the wavelet used.

The redundancy of this transform is (level + 1).

References

1

Donald B. Percival and Harold O. Mofjeld. Analysis of Subtidal Coastal Sea Level Fluctuations Using Wavelets. Journal of the American Statistical Association Vol. 92, No. 439 (Sep., 1997), pp. 868-880. https://doi.org/10.2307/2965551

Multilevel 2D mra2

pywt.mra2(data, wavelet, level=None, axes=(-2, -1), transform='swt2', mode='periodization')

Forward 2D multiresolution analysis.

It is a projection onto wavelet subspaces.

Parameters
data: array_like

Input data

waveletWavelet object or name string, or 2-tuple of wavelets

Wavelet to use. This can also be a tuple containing a wavelet to apply along each axis in axes.

levelint, optional

Decomposition level (must be >= 0). If level is None (default) then it will be calculated using the dwt_max_level function.

axes2-tuple of ints, optional

Axes over which to compute the DWT. Repeated elements are not allowed. Currently only available when transform='dwt2'.

transform{‘dwt2’, ‘swt2’}

Whether to use the DWT or SWT for the transforms.

modestr or 2-tuple of str, optional

Signal extension mode, see Modes (default: ‘symmetric’). This option is only used when transform=’dwt2’.

Returns
coeffslist

For more information, see the detailed description in wavedec2

See also

imra2, swt2

Notes

This is sometimes referred to as an additive decomposition because the inverse transform (imra2) is just the sum of the coefficient arrays [1]. The decomposition using transform='dwt' corresponds to section 2.2 while that using an undecimated transform (transform='swt') is described in section 3.2 and appendix A.

This transform does not share the variance partition property of swt2 with norm=True. It does however, result in coefficients that are temporally aligned regardless of the symmetry of the wavelet used.

The redundancy of this transform is 3 * level + 1.

References

1

Donald B. Percival and Harold O. Mofjeld. Analysis of Subtidal Coastal Sea Level Fluctuations Using Wavelets. Journal of the American Statistical Association Vol. 92, No. 439 (Sep., 1997), pp. 868-880. https://doi.org/10.2307/2965551

Multilevel n-dimensional mran

pywt.mran(data, wavelet, level=None, axes=None, transform='swtn', mode='periodization')

Forward nD multiresolution analysis.

It is a projection onto the wavelet subspaces.

Parameters
data: array_like

Input data

waveletWavelet object or name string, or tuple of wavelets

Wavelet to use. This can also be a tuple containing a wavelet to apply along each axis in axes.

levelint, optional

Decomposition level (must be >= 0). If level is None (default) then it will be calculated using the dwt_max_level function.

axestuple of ints, optional

Axes over which to compute the DWT. Repeated elements are not allowed.

transform{‘dwtn’, ‘swtn’}

Whether to use the DWT or SWT for the transforms.

modestr or tuple of str, optional

Signal extension mode, see Modes (default: ‘symmetric’). This option is only used when transform=’dwtn’.

Returns
coeffslist

For more information, see the detailed description in wavedecn.

See also

imran, swtn

Notes

This is sometimes referred to as an additive decomposition because the inverse transform (imran) is just the sum of the coefficient arrays [1]. The decomposition using transform='dwt' corresponds to section 2.2 while that using an undecimated transform (transform='swt') is described in section 3.2 and appendix A.

This transform does not share the variance partition property of swtn with norm=True. It does however, result in coefficients that are temporally aligned regardless of the symmetry of the wavelet used.

The redundancy of this transform is (2**n - 1) * level + 1 where n corresponds to the number of axes transformed.

References

1

Donald B. Percival and Harold O. Mofjeld. Analysis of Subtidal Coastal Sea Level Fluctuations Using Wavelets. Journal of the American Statistical Association Vol. 92, No. 439 (Sep., 1997), pp. 868-880. https://doi.org/10.2307/2965551

Inverse Multilevel 1D imra

pywt.imra(mra_coeffs)

Inverse 1D multiresolution analysis via summation.

Parameters
mra_coeffslist of ndarray

Multiresolution analysis coefficients as returned by mra.

Returns
recndarray

The reconstructed signal.

See also

mra

References

1

Donald B. Percival and Harold O. Mofjeld. Analysis of Subtidal Coastal Sea Level Fluctuations Using Wavelets. Journal of the American Statistical Association Vol. 92, No. 439 (Sep., 1997), pp. 868-880. https://doi.org/10.2307/2965551

Inverse Multilevel 2D imra2

pywt.imra2(mra_coeffs)

Inverse 2D multiresolution analysis via summation.

Parameters
mra_coeffslist

Multiresolution analysis coefficients as returned by mra2.

Returns
recndarray

The reconstructed signal.

See also

mra2

References

1

Donald B. Percival and Harold O. Mofjeld. Analysis of Subtidal Coastal Sea Level Fluctuations Using Wavelets. Journal of the American Statistical Association Vol. 92, No. 439 (Sep., 1997), pp. 868-880. https://doi.org/10.2307/2965551

Inverse Multilevel n-dimensional imran

pywt.imran(mra_coeffs)

Inverse nD multiresolution analysis via summation.

Parameters
mra_coeffslist

Multiresolution analysis coefficients as returned by mra2.

Returns
recndarray

The reconstructed signal.

See also

mran

References

1

Donald B. Percival and Harold O. Mofjeld. Analysis of Subtidal Coastal Sea Level Fluctuations Using Wavelets. Journal of the American Statistical Association Vol. 92, No. 439 (Sep., 1997), pp. 868-880. https://doi.org/10.2307/2965551