Exemple #1
0
 def test_rotation2(self):
     """
     Test create_rotations with 180 rotation only.
     """
     result = Quilt.create_rotations(self.a, 2)
     expected = np.asarray([[0, 1, 2, 3], [5, 6, 7, 8], [4, 9, 2, 3],
                            [0, 0, 0, 0], [3, 2, 9, 4], [8, 7, 6, 5],
                            [3, 2, 1, 0]])
     np.testing.assert_array_equal(expected, result)
Exemple #2
0
 def test_rotation4(self):
     """
     Test create_rotations with 4 rotations (every 90 degrees)
     """
     result = Quilt.create_rotations(self.a, 4)
     expected = np.asarray([[0, 1, 2, 3, 0, 3, 8, 3, 0, 4, 5, 0],
                            [5, 6, 7, 8, 0, 2, 7, 2, 0, 9, 6, 1],
                            [4, 9, 2, 3, 0, 1, 6, 9, 0, 2, 7, 2],
                            [0, 0, 0, 0, 0, 0, 5, 4, 0, 3, 8, 3],
                            [3, 2, 9, 4, 0, 0, 0, 0, 0, 0, 0, 0],
                            [8, 7, 6, 5, 0, 0, 0, 0, 0, 0, 0, 0],
                            [3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]])
     np.testing.assert_array_equal(expected, result)
Exemple #3
0
 def test_rotation4_invert(self):
     """
     Test create_rotations with 4 rotations (every 90 degrees). Test it with
     a matrix that has height>width
     """
     a = np.rot90(self.a, -1)
     result = Quilt.create_rotations(a, 4)
     expected = np.asarray([[0, 1, 2, 3, 0, 3, 8, 3, 0, 4, 5, 0],
                            [5, 6, 7, 8, 0, 2, 7, 2, 0, 9, 6, 1],
                            [4, 9, 2, 3, 0, 1, 6, 9, 0, 2, 7, 2],
                            [0, 0, 0, 0, 0, 0, 5, 4, 0, 3, 8, 3],
                            [3, 2, 9, 4, 0, 0, 0, 0, 0, 0, 0, 0],
                            [8, 7, 6, 5, 0, 0, 0, 0, 0, 0, 0, 0],
                            [3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]])
     np.testing.assert_array_equal(expected, result)