def test_ifwt2c(self): from RandomArray import seed, random seed(13, 17) X = random((8, 4)) Y = ifwt2(X) Y = ifwt2(Y) Y = fwt2(Y) X1 = fwt2(Y) assert Numeric.allclose(X - X1, 0)
def test_fwt2c(self): X = Numeric.ones(8 * 4, Numeric.Float) X = Numeric.reshape(X, (8, 4)) for i in range(8): X[i, 0] = 1 X[i, 1] = 2 X[i, 2] = 3 X[i, 3] = 4 Y_ref = Numeric.array( [ [14.14213562373095, -4.89897948556636, 0.0, -4.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], ] ) Y = fwt2(X) Y -= Y_ref assert Numeric.allclose(Y, 0)
def test_fwt2d(self): X = Numeric.ones(8 * 4, Numeric.Float) X = Numeric.reshape(X, (8, 4)) for i in range(8): X[i, 0] = i + 1 X[i, 1] = 1 X[i, 2] = i + 1 X[i, 3] = 2 Y_ref = Numeric.array( [ [16.97056274847714, -1.93185165257814, 5.63397459621556, 6.3660254037844], [-4.38134139536131, 0.0, -3.09807621135332, -3.09807621135332], [0.36602540378444, 0.0, 0.25881904510252, 0.25881904510252], [-3.83012701892219, 0.0, -2.70830878788570, -2.70830878788570], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [-2.82842712474619, 0.0, -2.0, -2.0], ] ) Y = fwt2(X) Y -= Y_ref assert Numeric.allclose(Y, 0)
def test_big(self): from RandomArray import seed, random seed(13, 17) X = random((1024, 512)) Y = fwt2(X) X1 = ifwt2(Y) assert Numeric.allclose(X - X1, 0)
def test_fwt2b(self): """Simple 2D test..... """ X = Numeric.ones(8 * 4, Numeric.Float) X = Numeric.reshape(X, (8, 4)) Y = fwt2(X) Y[0][0] -= sqrt(Numeric.product(Y.shape)) assert Numeric.allclose(Y, 0)