Tip

This page can also be run or downloaded as a Jupyter notebook.

Gotchas#

PyWavelets utilizes NumPy under the hood. That’s why handling the data that contains None values can be surprising. None values are converted to ‘not a number’ (numpy.nan) values:

import numpy, pywt
x = [None, None]
mode = 'symmetric'
wavelet = 'db1'
cA, cD = pywt.dwt(x, wavelet, mode)

The results are:

numpy.all(numpy.isnan(cA))
np.True_
numpy.all(numpy.isnan(cD))
np.True_
rec = pywt.idwt(cA, cD, wavelet, mode)
numpy.all(numpy.isnan(rec))
np.True_