Skip to content

Commit 5d87261

Browse files
committed
TST: add test for idwt2 with some coefficients as None
1 parent 24323f9 commit 5d87261

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

pywt/tests/test_multidim.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,23 @@ def test_idwtn_axes():
262262
assert_allclose(pywt.idwtn(coefs, 'haar', axes=(1, 1)), data, atol=1e-14)
263263

264264

265+
def test_idwt2_none_coeffs():
266+
data = np.array([[0, 1, 2, 3],
267+
[1, 1, 1, 1],
268+
[1, 4, 2, 8]])
269+
data = data + 1j*data # test with complex data
270+
cA, (cH, cV, cD) = pywt.dwt2(data, 'haar', axes=(1, 1))
271+
272+
# verify setting coefficients to None is the same as zeroing them
273+
cD = np.zeros_like(cD)
274+
result_zeros = pywt.idwt2((cA, (cH, cV, cD)), 'haar', axes=(1, 1))
275+
276+
cD = None
277+
result_none = pywt.idwt2((cA, (cH, cV, cD)), 'haar', axes=(1, 1))
278+
279+
assert_equal(result_zeros, result_none)
280+
281+
265282
def test_idwtn_none_coeffs():
266283
data = np.array([[0, 1, 2, 3],
267284
[1, 1, 1, 1],

0 commit comments

Comments
 (0)