Пример #1
0
    def test_flipud(self):
        planes = np.array([[[0, 1], [0, 0]], [[1, 0], [0, 0]]])

        expected_planes = np.array([[[0, 0], [0, 1]], [[0, 0], [1, 0]]])

        npt.assert_array_equal(THTransformation.flipud(planes),
                               expected_planes)
Пример #2
0
    def test_diagonal_right_down(self):
        planes = np.array([[[0, 1], [0, 0]], [[1, 0], [0, 0]]])

        expected_planes = np.array([[[0, 0], [1, 0]], [[1, 0], [0, 0]]])

        npt.assert_array_equal(THTransformation.diagonal_right_down(planes),
                               expected_planes)
Пример #3
0
    def test_rotate_270(self):
        planes = np.array([[[0, 1], [0, 0]], [[1, 0], [0, 0]]])

        expected_planes = np.array([[[0, 0], [0, 1]], [[0, 1], [0, 0]]])

        npt.assert_array_equal(THTransformation.rotate_270(planes),
                               expected_planes)
Пример #4
0
    def test_inverse(self):
        planes = np.array([[[0, 1], [0, 0]], [[1, 0], [0, 0]]])

        npt.assert_array_equal(
            planes,
            THTransformation.rotate_90((THTransformation.rotate_270(planes))))
        npt.assert_array_equal(
            planes,
            THTransformation.rotate_180((THTransformation.rotate_180(planes))))
        npt.assert_array_equal(
            planes,
            THTransformation.rotate_270((THTransformation.rotate_90(planes))))

        npt.assert_array_equal(
            planes, THTransformation.fliplr((THTransformation.fliplr(planes))))
        npt.assert_array_equal(
            planes, THTransformation.flipud((THTransformation.flipud(planes))))
        npt.assert_array_equal(
            planes,
            THTransformation.diagonal_left_down(
                (THTransformation.diagonal_left_down(planes))))
        npt.assert_array_equal(
            planes,
            THTransformation.diagonal_right_down(
                (THTransformation.diagonal_right_down(planes))))