MCPcopy Create free account
hub / github.com/PyWavelets/pywt / test_collecting_nodes_nd

Function test_collecting_nodes_nd

pywt/tests/test_wpnd.py:67–86  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

65
66
67def test_collecting_nodes_nd():
68 x = np.array([[1, 2, 3, 4, 5, 6, 7, 8]] * 8, dtype=np.float64)
69 wp = pywt.WaveletPacketND(data=x, wavelet='db1', mode='symmetric')
70
71 assert_(len(wp.get_level(0)) == 1)
72 assert_(wp.get_level(0)[0].path == '')
73
74 # First level
75 assert_(len(wp.get_level(1)) == 4)
76 assert_(
77 [node.path for node in wp.get_level(1)] == ['aa', 'ad', 'da', 'dd'])
78
79 # Second and third levels
80 for lev in [2, 3]:
81 assert_(len(wp.get_level(lev)) == (2**x.ndim)**lev)
82 paths = [node.path for node in wp.get_level(lev)]
83 expected_paths = [
84 reduce(operator.add, p) for
85 p in sorted(product(['aa', 'ad', 'da', 'dd'], repeat=lev))]
86 assert_(paths == expected_paths)
87
88
89def test_data_reconstruction_delete_nodes_nd():

Callers

nothing calls this directly

Calls 1

get_levelMethod · 0.95

Tested by

no test coverage detected