Mentions légales du service

Skip to content

lazylinop.wip.dwt error if in1 is 1D

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

x = np.random.randn(16)
lls.dwt(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:556, in _dwt(hfilter, lfilter, mode, level, **kwargs)
    554 elif key == 'shape':
    555     shape = value
--> 556     use_1d = bool(not shape[0] is None and shape[1] is None)
    557     use_2d = bool(not shape[0] is None and not shape[1] is None)
    558 elif key == 'implementation':

IndexError: tuple index out of range

sphape[1] does not exist, something like len(shape) should be used instead