Skip to content

Commit 0e1ec39

Browse files
committed
FIX: idwtn should treat None coefficients as described in the docstring.
This change also makes is consistent with the existing idwt2 behavior
1 parent f08928f commit 0e1ec39

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

pywt/_multidim.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,6 @@ def idwt2(coeffs, wavelet, mode='symmetric', axes=(-2, -1)):
106106
raise ValueError("Expected 2 axes")
107107

108108
coeffs = {'aa': LL, 'da': HL, 'ad': LH, 'dd': HH}
109-
110-
# drop the keys corresponding to value = None
111-
coeffs = dict((k, v) for k, v in coeffs.items() if v is not None)
112-
113109
return idwtn(coeffs, wavelet, mode, axes)
114110

115111

@@ -240,6 +236,9 @@ def idwtn(coeffs, wavelet, mode='symmetric', axes=None):
240236
wavelet = Wavelet(wavelet)
241237
mode = Modes.from_object(mode)
242238

239+
# drop the keys corresponding to value = None
240+
coeffs = dict((k, v) for k, v in coeffs.items() if v is not None)
241+
243242
# Raise error for invalid key combinations
244243
coeffs = _fix_coeffs(coeffs)
245244

0 commit comments

Comments
 (0)