Example #1
0
    def test_get_padding_size_3(self):

        shape = c(7, 11, 7)
        pos = c(5, 5, 5)
        size = c(3, 5, 3)
        res = ds.inner_tile_size(shape, pos, size)
        np.testing.assert_array_equal([(0, 1), (0, 0), (0, 1)], res[-1])
Example #2
0
    def test_get_padding_size_2(self):

        shape = c(7, 11)
        pos = c(-3, 0)
        size = c(3, 5)

        res = ds.inner_tile_size(shape, pos, size)
        np.testing.assert_array_equal([(3, 0), (0, 0)], res[-1])
Example #3
0
    def test_inner_tile_size_5(self):

        shape = c(7, 11)
        pos = c(2, -4)
        size = c(3, 8)

        pos_val = c(2, 0)
        size_val = c(3, 4)

        pos_out, size_out, pos_tile, pd = \
            ds.inner_tile_size(shape, pos, size)

        np.testing.assert_array_equal(pos_out, pos_val)
        np.testing.assert_array_equal(size_out, size_val)
        np.testing.assert_array_equal(pos_tile, (0, 0))
        np.testing.assert_array_equal(pd, [(0, 0), (4, 0)])
Example #4
0
    def test_inner_tile_size_9(self):

        shape = c(7, 11)
        pos = c(-4, -1)
        size = c(6, 6)

        pos_val = c(0, 0)
        size_val = c(4, 5)

        pos_out, size_out, pos_tile, pd = \
            ds.inner_tile_size(shape, pos, size)

        np.testing.assert_array_equal(tuple(pos_out), pos_val)
        np.testing.assert_array_equal(tuple(size_out), size_val)
        np.testing.assert_array_equal(tuple(pos_tile), (0, 0))
        np.testing.assert_array_equal(pd, [(4, 0), (1, 0)])
Example #5
0
    def test_inner_tile_size_2(self):

        shape = c(7, 11)
        pos = c(-4, -1)
        size = c(5, 8)

        pos_val = c(0, 0)
        size_val = c(4, 7)

        pos_out, size_out, pos_tile, pd = \
            ds.inner_tile_size(shape, pos, size)

        print(pos_out)
        print(size_out)

        np.testing.assert_array_equal(pos_out, pos_val)
        np.testing.assert_array_equal(size_out, size_val)
        np.testing.assert_array_equal(pos_tile, (0, 0))
        np.testing.assert_array_equal(pd, [(4, 0), (1, 0)])
Example #6
0
    def test_inner_tile_size_1(self):

        shape = c(7, 11)
        pos = c(-4, 8)
        size = c(16, 9)

        pos_val = c(0, 5)
        size_val = c(7, 6)
        pos_tile_val = c(0, 3)
        pos_out, size_out, pos_tile, padding = \
            ds.inner_tile_size(shape, pos, size)

        print(pos_out)
        print(size_out)

        np.testing.assert_array_equal(pos_out, pos_val)
        np.testing.assert_array_equal(size_out, size_val)
        np.testing.assert_array_equal(pos_tile_val, pos_tile)
        np.testing.assert_array_equal(padding, [(4, 5), (0, 6)])
Example #7
0
    def test_inner_tile_size_10(self):

        shape = c(7, 11)
        pos = c(6, 7)
        size = c(4, 3)

        pos_val = c(4, 7)
        size_val = c(3, 3)

        pos_out, size_out, pos_tile, pd = \
            ds.inner_tile_size(shape, pos, size)

        print(pos_out)
        print(size_out)

        np.testing.assert_array_equal(pos_out, pos_val)
        np.testing.assert_array_equal(size_out, size_val)
        np.testing.assert_array_equal(pos_tile, (2, 0))
        np.testing.assert_array_equal(pd, [(0, 3), (0, 0)])
Example #8
0
    def test_inner_tile_size_8(self):

        shape = c(7, 11)
        pos = c(5, 9)
        size = c(5, 6)

        pos_val = c(4, 7)
        size_val = c(3, 4)

        pos_out, size_out, pos_tile, pd = \
            ds.inner_tile_size(shape, pos, size)

        print(pos_out)
        print(size_out)

        np.testing.assert_array_equal(tuple(pos_out), pos_val)
        np.testing.assert_array_equal(tuple(size_out), size_val)
        np.testing.assert_array_equal(tuple(pos_tile), (1, 2))
        np.testing.assert_array_equal(pd, [(0, 3), (0, 4)])
Example #9
0
    def test_inner_tile_size_7(self):

        shape = c(7, 11)
        pos = c(2, 9)
        size = c(6, 5)

        pos_val = c(2, 8)
        size_val = c(5, 3)

        pos_out, size_out, pos_tile, pd = \
            ds.inner_tile_size(shape, pos, size)

        print(pos_out)
        print(size_out)

        np.testing.assert_array_equal(pos_out, pos_val)
        np.testing.assert_array_equal(size_out, size_val)
        np.testing.assert_array_equal(pos_tile, (0, 1))
        np.testing.assert_array_equal(pd, [(0, 1), (0, 3)])
Example #10
0
    def test_inner_tile_size_6(self):

        shape = c(7, 11)
        pos = c(2, 9)
        size = c(3, 6)

        pos_val = c(2, 7)
        size_val = c(3, 4)

        pos_out, size_out, pos_tile, pd = \
            ds.inner_tile_size(shape, pos, size)

        print(pos_out)
        print(size_out)

        np.testing.assert_array_equal(pos_out, pos_val)
        np.testing.assert_array_equal(size_out, size_val)
        np.testing.assert_array_equal(pos_tile, (0, 2))
        np.testing.assert_array_equal(pd, [(0, 0), (0, 4)])
Example #11
0
    def test_inner_tile_size_4(self):

        shape = c(7, 11)
        pos = c(-5, 2)
        size = c(6, 4)

        pos_val = c(0, 2)
        size_val = c(5, 4)

        pos_out, size_out, pos_tile, pd = \
            ds.inner_tile_size(shape, pos, size)

        print(pos_out)
        print(size_out)

        np.testing.assert_array_equal(pos_out, pos_val)
        np.testing.assert_array_equal(size_out, size_val)
        np.testing.assert_array_equal(pos_tile, (0, 0))
        np.testing.assert_array_equal(pd, [(5, 0), (0, 0)])
Example #12
0
    def test_inner_tile_size_3(self):

        shape = c(7, 11)
        pos = c(-2, -3)
        size = c(3, 4)

        pos_val = c(0, 0)
        size_val = c(2, 3)

        pos_out, size_out, pos_tile, pd = \
            ds.inner_tile_size(shape, pos, size)

        print(pos_out)
        print(size_out)

        np.testing.assert_array_equal(pos_out, pos_val)
        np.testing.assert_array_equal(size_out, size_val)
        np.testing.assert_array_equal(pos_tile, (0, 0))
        np.testing.assert_array_equal(pd, [(2, 0), (3, 0)])