def _test_wavedec2(self, wavelet, shape, levels): import pywt ll = int(np.log2(max(shape))) A = np.arange(np.prod(shape)).reshape(shape) coefs = pywt.wavedec2(A, wavelet, mode='per', level=ll) # including 0th level as one u_ref = wv.structured_to_contiguous(coefs[:levels + 1]) wavedec2, waverec2 = wv.daubechies_factory(shape, wavelet=wavelet) u = wavedec2(A, levels=levels) np.testing.assert_array_almost_equal(u_ref, u) return u
def _test_wavedec(self, wavelet, length, levels): import pywt ll = int(np.log2(length)) A = np.arange(length) coefs = pywt.wavedec(A, wavelet, mode='per', level=ll) # including 0th level as one u_ref = wv.structured_to_contiguous(coefs[:levels + 1]) wavedec, waverec = wv.daubechies_factory(length, wavelet=wavelet) u = wavedec(A, levels=levels) np.testing.assert_array_almost_equal(u_ref, u) return u
def _test_wavedec2(self, wavelet, shape, levels): import pywt ll = int(np.log2(max(shape))) A = np.arange(np.prod(shape)).reshape(shape) coefs = pywt.wavedec2(A, wavelet, mode="per", level=ll) # including 0th level as one u_ref = wv.structured_to_contiguous(coefs[: levels + 1]) wavedec2, waverec2 = wv.daubechies_factory(shape, wavelet=wavelet) u = wavedec2(A, levels=levels) np.testing.assert_array_almost_equal(u_ref, u) return u
def _test_wavedec(self, wavelet, length, levels): import pywt ll = int(np.log2(length)) A = np.arange(length) coefs = pywt.wavedec(A, wavelet, mode="per", level=ll) # including 0th level as one u_ref = wv.structured_to_contiguous(coefs[: levels + 1]) wavedec, waverec = wv.daubechies_factory(length, wavelet=wavelet) u = wavedec(A, levels=levels) np.testing.assert_array_almost_equal(u_ref, u) return u