Beispiel #1
0
    def test_low_pass_2_3(self):
        r = np.array([[[0.3088114, 0.24855971, 0.39614979],
                       [0.33504927, 0.36201988, 0.55967795],
                       [0.22154193, 0.35337206, 0.46181069],
                       [0.13350745, 0.23712374, 0.2895637]],
                      [[0.30984611, 0.25329434, 0.39856696],
                       [0.34230614, 0.35664168, 0.56242281],
                       [0.23367623, 0.3610497, 0.46558965],
                       [0.14036547, 0.23883435, 0.29052476]]])

        # alternate result, which is based on more exact numeric integral
        r_alternate = np.array([[[0.30842096, 0.24838884, 0.39577196],
                                 [0.33501527, 0.36180561, 0.55950431],
                                 [0.22166263, 0.3532943, 0.46158449],
                                 [0.13340038, 0.23694009, 0.28940603]],
                                [[0.30944436, 0.25303936, 0.39814189],
                                 [0.34211247, 0.35650942, 0.56218549],
                                 [0.23353816, 0.36085143, 0.46528782],
                                 [0.14011613, 0.23858205, 0.29034499]]])
        self.assertTrue(
            np.allclose(
                hybrid.low_pass(self.img1, 2, 3), r, rtol=1e-4, atol=1e-08)
            or np.allclose(hybrid.low_pass(self.img1, 2, 3),
                           r_alternate,
                           rtol=1e-4,
                           atol=1e-08))
Beispiel #2
0
    def test_low_pass_9_7(self):
        r = np.array([[[0.17963478, 0.17124501, 0.12221388],
                       [0.21933258, 0.20746511, 0.16113371],
                       [0.22114507, 0.20886138, 0.16244521],
                       [0.22029549, 0.20774176, 0.16180487],
                       [0.18792763, 0.17151596, 0.13658299]],
                      [[0.18170777, 0.17314406, 0.12382304],
                       [0.22168257, 0.20972768, 0.1634043],
                       [0.2235093, 0.21113553, 0.1647422],
                       [0.22264545, 0.2100001, 0.16410069],
                       [0.18989056, 0.17328373, 0.13859635]],
                      [[0.18158356, 0.17294561, 0.12393794],
                       [0.22135196, 0.20945285, 0.1637038],
                       [0.22317083, 0.21085531, 0.16505207],
                       [0.22230311, 0.20971788, 0.16441722],
                       [0.18955739, 0.17295608, 0.13893827]],
                      [[0.17926668, 0.17065694, 0.12255439],
                       [0.2183528, 0.20665068, 0.16202127],
                       [0.22014196, 0.20803099, 0.16336348],
                       [0.21928093, 0.20690543, 0.16274287],
                       [0.18694027, 0.17054497, 0.13759625]]])

        # alternate result, which is based on more exact numeric integral
        r_alternate = np.array([[[0.17963458, 0.17124395, 0.12221343],
                                 [0.2193303, 0.20746254, 0.16113291],
                                 [0.22114092, 0.20885738, 0.16244308],
                                 [0.2202922, 0.2077389, 0.1618034],
                                 [0.18792575, 0.17151434, 0.13658246]],
                                [[0.18170545, 0.17314105, 0.12382096],
                                 [0.22167787, 0.20972279, 0.16340117],
                                 [0.2235027, 0.21112917, 0.16473771],
                                 [0.22263973, 0.20999491, 0.16409686],
                                 [0.18988667, 0.17328031, 0.13859375]],
                                [[0.18158137, 0.17294281, 0.12393574],
                                 [0.22134759, 0.20944824, 0.16370037],
                                 [0.22316458, 0.21084925, 0.16504725],
                                 [0.22229775, 0.209713, 0.16441304],
                                 [0.18955385, 0.17295299, 0.1389353]],
                                [[0.17926684, 0.17065647, 0.12255362],
                                 [0.2183515, 0.20664894, 0.16201958],
                                 [0.22013885, 0.20802785, 0.16336041],
                                 [0.21927869, 0.20690345, 0.16274041],
                                 [0.18693941, 0.17054435, 0.13759465]]])

        self.assertTrue(
            np.allclose(
                hybrid.low_pass(self.img2, 9, 7), r, rtol=1e-4, atol=1e-08)
            or np.allclose(hybrid.low_pass(self.img2, 9, 7),
                           r_alternate,
                           rtol=1e-4,
                           atol=1e-08))
Beispiel #3
0
    def test_low_pass_9_7(self):
        r = np.array([[[ 0.17963478,  0.17124501,  0.12221388],
        [ 0.21933258,  0.20746511,  0.16113371],
        [ 0.22114507,  0.20886138,  0.16244521],
        [ 0.22029549,  0.20774176,  0.16180487],
        [ 0.18792763,  0.17151596,  0.13658299]],

       [[ 0.18170777,  0.17314406,  0.12382304],
        [ 0.22168257,  0.20972768,  0.1634043 ],
        [ 0.2235093 ,  0.21113553,  0.1647422 ],
        [ 0.22264545,  0.2100001 ,  0.16410069],
        [ 0.18989056,  0.17328373,  0.13859635]],

       [[ 0.18158356,  0.17294561,  0.12393794],
        [ 0.22135196,  0.20945285,  0.1637038 ],
        [ 0.22317083,  0.21085531,  0.16505207],
        [ 0.22230311,  0.20971788,  0.16441722],
        [ 0.18955739,  0.17295608,  0.13893827]],

       [[ 0.17926668,  0.17065694,  0.12255439],
        [ 0.2183528 ,  0.20665068,  0.16202127],
        [ 0.22014196,  0.20803099,  0.16336348],
        [ 0.21928093,  0.20690543,  0.16274287],
        [ 0.18694027,  0.17054497,  0.13759625]]])
	self.assertTrue(np.allclose(hybrid.low_pass(self.img2, 9, 7), r,
		atol=1e-08))
Beispiel #4
0
    def test_low_pass_2_3(self):
        r = np.array([[[0.3088114, 0.24855971, 0.39614979],
                       [0.33504927, 0.36201988, 0.55967795],
                       [0.22154193, 0.35337206, 0.46181069],
                       [0.13350745, 0.23712374, 0.2895637]],
                      [[0.30984611, 0.25329434, 0.39856696],
                       [0.34230614, 0.35664168, 0.56242281],
                       [0.23367623, 0.3610497, 0.46558965],
                       [0.14036547, 0.23883435, 0.29052476]]])

        self.assertTrue(
            np.allclose(hybrid.low_pass(self.img1, 2, 3), r, atol=1e-08))