Mentions légales du service

Skip to content

dwt2d() error if level not provided

from lazylinop.wip import signal as lls
import numpy as np
import pywt

x = np.random.randn(16).reshape(4, 4)
lls.dwt2d(x.shape, hfilter=np.array(pywt.Wavelet('haar').dec_hi), lfilter=np.array(pywt.Wavelet('haar').dec_lo))

fails with:

File venv/lib/python3.10/site-packages/lazylinop/wip/signal.py:2550, in dwt2d(shape, hfilter, lfilter, boundary, level)
   2548 if not level is None and level > K:
   2549     raise ValueError("decomposition level is greater than the maximum decomposition level.")
-> 2550 D = K if level < 1 else min(K, level)
   2552 # boundary condition
   2553 if boundary == 'zero':

TypeError: '<' not supported between instances of 'NoneType' and 'int'

(because level is None by default)