示例#1
0
 def test_homochoric(self, set_of_rotations, P):
     cutoff = np.tan(np.pi * .5 * (1. - 1e-4))
     for rot in set_of_rotations:
         m = rot.as_Rodrigues()
         o = Rotation.from_homochoric(rot.as_homochoric() * P * -1,
                                      P).as_Rodrigues()
         ok = np.allclose(np.clip(m, None, cutoff),
                          np.clip(o, None, cutoff),
                          atol=atol)
         ok = ok or np.isclose(m[3], 0.0, atol=atol)
         assert ok and np.isclose(np.linalg.norm(o[:3]),
                                  1.0), f'{m},{o},{rot.as_quaternion()}'
示例#2
0
 def test_homochoric(self, default, P):
     cutoff = np.tan(np.pi * .5 * (1. - 1e-4))
     for rot in default:
         m = rot.as_Rodrigues()
         o = Rotation.from_homochoric(rot.as_homochoric() * P * -1,
                                      P).as_Rodrigues()
         ok = np.allclose(np.clip(m, None, cutoff),
                          np.clip(o, None, cutoff),
                          atol=atol)
         ok = ok or np.isclose(m[3], 0.0, atol=atol)
         print(m, o, rot.as_quaternion())
         assert ok and np.isclose(np.linalg.norm(o[:3]), 1.0)