Other functions

Integrating wavelet functions

pywt.integrate_wavelet(wavelet, precision=8)

Integrate psi wavelet function from -Inf to x using the rectangle integration method.

Parameters:
wavelet : Wavelet instance or str

Wavelet to integrate. If a string, should be the name of a wavelet.

precision : int, optional

Precision that will be used for wavelet function approximation computed with the wavefun(level=precision) Wavelet’s method (default: 8).

Returns:
[int_psi, x] :

for orthogonal wavelets

[int_psi_d, int_psi_r, x] :

for other wavelets

Examples

>>> from pywt import Wavelet, integrate_wavelet
>>> wavelet1 = Wavelet('db2')
>>> [int_psi, x] = integrate_wavelet(wavelet1, precision=5)
>>> wavelet2 = Wavelet('bior1.3')
>>> [int_psi_d, int_psi_r, x] = integrate_wavelet(wavelet2, precision=5)

The result of the call depends on the wavelet argument:

  • for orthogonal and continuous wavelets - an integral of the wavelet function specified on an x-grid:

    [int_psi, x_grid] = integrate_wavelet(wavelet, precision)
    
  • for other wavelets - integrals of decomposition and reconstruction wavelet functions and a corresponding x-grid:

    [int_psi_d, int_psi_r, x_grid] = integrate_wavelet(wavelet, precision)
    

Central frequency of psi wavelet function

pywt.central_frequency(wavelet, precision=8)

Computes the central frequency of the psi wavelet function.

Parameters:
wavelet : Wavelet instance, str or tuple

Wavelet to integrate. If a string, should be the name of a wavelet.

precision : int, optional

Precision that will be used for wavelet function approximation computed with the wavefun(level=precision) Wavelet’s method (default: 8).

Returns:
scalar
pywt.scale2frequency(wavelet, scale, precision=8)
Parameters:
wavelet : Wavelet instance or str

Wavelet to integrate. If a string, should be the name of a wavelet.

scale : scalar
precision : int, optional

Precision that will be used for wavelet function approximation computed with wavelet.wavefun(level=precision). Default is 8.

Returns:
freq : scalar

Quadrature Mirror Filter

pywt.qmf(filt)

Returns the Quadrature Mirror Filter(QMF).

The magnitude response of QMF is mirror image about pi/2 of that of the input filter.

Parameters:
filt : array_like

Input filter for which QMF needs to be computed.

Returns:
qm_filter : ndarray

Quadrature mirror of the input filter.

Orthogonal Filter Banks

pywt.orthogonal_filter_bank(scaling_filter)

Returns the orthogonal filter bank.

The orthogonal filter bank consists of the HPFs and LPFs at decomposition and reconstruction stage for the input scaling filter.

Parameters:
scaling_filter : array_like

Input scaling filter (father wavelet).

Returns:
orth_filt_bank : tuple of 4 ndarrays

The orthogonal filter bank of the input scaling filter in the order : 1] Decomposition LPF 2] Decomposition HPF 3] Reconstruction LPF 4] Reconstruction HPF

Example Datasets

The following example datasets are available in the module pywt.data:

name description
ecg ECG waveform (1024 samples)
aero grayscale image (512x512)
ascent grayscale image (512x512)
camera grayscale image (512x512)
nino sea surface temperature (264 samples)

Each can be loaded via a function of the same name.

Example: .. sourcecode:: python

>>> import pywt
>>> camera = pywt.data.camera()