Example #1
0
    def test1_sum_one_moving_block(self):
        """
        """
        vol = np.asarray( [1, 3, 4] )

        one_block = Block([ slice(0, 2) ])
        block_set = spanning_blocks(array_shape=vol.shape,
            block_shape=one_block.shape, step=1)

        R, lags = sum_one_moving_block(vol, one_block, block_set)

        R_real = (2.0, 1.0)
        lags_real = ([0], [1])

        self.assertEqual(R, R_real)
        self.assertEqual(lags, lags_real)
Example #2
0
    def test2_sum_one_moving_block(self):
        """
        """
        vol = np.asarray( [[1, 2, 3],
                    [4, 5, 6],
                    [7, 8, 9]] )

        one_block = Block([slice(0,2), slice(0, 2)])
        block_set = spanning_blocks(array_shape=vol.shape,
            block_shape=one_block.shape, step=1)

        R, lags = sum_one_moving_block(vol, one_block, block_set)
        R_real = (10.0, 10.0, 10.0, 10.0)
        lags_real = ([0, 0], [0, 1], [1, 0], [1, 1])

        self.assertEqual(R, R_real)
        self.assertEqual(lags, lags_real)