# 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
waveletWavelet instance or str

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

precisionint, 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
waveletWavelet instance, str or tuple

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

precisionint, 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)

Convert from CWT “scale” to normalized frequency.

Parameters
waveletWavelet instance or str

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

scalescalar

The scale of the CWT.

precisionint, optional

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

Returns
freqscalar

Frequency normalized to the sampling frequency. In other words, for a sampling interval of dt seconds, the normalized frequency of 1.0 corresponds to (1/dt Hz).

## 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
filtarray_like

Input filter for which QMF needs to be computed.

Returns
qm_filterndarray

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_filterarray_like

Input scaling filter (father wavelet).

Returns
orth_filt_banktuple 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)

demo_signal

various synthetic 1d test signals

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

pywt.data.demo_signal(name='Bumps', n=None)

Simple 1D wavelet test functions.

This function can generate a number of common 1D test signals used in papers by David Donoho and colleagues (e.g. ) as well as the wavelet book by Stéphane Mallat .

Parameters
name{‘Blocks’, ‘Bumps’, ‘HeaviSine’, ‘Doppler’, …}

The type of test signal to generate (name is case-insensitive). If name is set to ‘list’, a list of the available test functions is returned.

nint or None

The length of the test signal. This should be provided for all test signals except ‘Gabor’ and ‘sineoneoverx’ which have a fixed length.

Returns
fnp.ndarray

Array of length `n` corresponding to the specified test signal type.

Notes

This function is a partial reimplementation of the MakeSignal function from the [Wavelab](https://statweb.stanford.edu/~wavelab/) toolbox. These test signals are provided with permission of Dr. Donoho to encourage reproducible research.

References

1

D.L. Donoho and I.M. Johnstone. Ideal spatial adaptation by wavelet shrinkage. Biometrika, vol. 81, pp. 425–455, 1994.

2

S. Mallat. A Wavelet Tour of Signal Processing: The Sparse Way. Academic Press. 2009.

Example:

```>>> import pywt
>>> camera = pywt.data.camera()
>>> doppler = pywt.data.demo_signal('doppler', 1024)
>>> available_signals = pywt.data.demo_signal('list')
```