Example #1
0
 def test_from_matrix(self):
     r = Rotation([[1, 0, 0, 0], [3, 0, 0, 0], [0, 1, 0, 0], [0, 2, 0, 0]])
     om = np.array(
         [np.eye(3), np.eye(3), np.diag([1, -1, -1]), np.diag([1, -1, -1])]
     )
     assert np.allclose(Rotation.from_matrix(om).data, r.data)
     assert np.allclose(
         Rotation.from_matrix(om.reshape((2, 2, 3, 3))).data, r.reshape(2, 2).data
     )
Example #2
0
 def test_from_to_matrix(self):
     om = np.array(
         [np.eye(3),
          np.eye(3),
          np.diag([1, -1, -1]),
          np.diag([1, -1, -1])])
     assert np.allclose(Rotation.from_matrix(om).to_matrix(), om)
Example #3
0
 def test_get_rotation_matrix_from_diffpy(self):
     """Checking that getting rotation matrices from diffpy.structure
     works without issue.
     """
     r = Rotation.from_matrix([i.R for i in sg225.symop_list])
     assert not np.isnan(r.data).any()
Example #4
0
 def test_from_to_matrix2(self, e):
     r = Rotation.from_euler(e.reshape((5, 2, 3)))
     assert np.allclose(Rotation.from_matrix(r.to_matrix()).data, r.data)