コード例 #1
0
def test_interconversion_euler_axangle(random_axangles):
    """
    This function checks (with random numbers) that .to_Axangle() and .to_Euler()
    go back and forth correctly
    """
    z = random_axangles.copy()
    z[:, :3] = np.divide(random_axangles[:, :3], np.linalg.norm(
        random_axangles[:, :3], axis=1).reshape(z.shape[0], 1))  # normalise
    axangle = AxAngle(z)
    e = axangle.to_Euler(axis_convention='rzxz')
    transform_back = e.to_AxAngle()
    assert isinstance(transform_back, AxAngle)
    assert np.allclose(transform_back.data, axangle.data)
コード例 #2
0
def test_orthogonal_linear_case_for_cyclic_group(fz_string):
    """ Rotations about the x direction are never removed by the effects of the cyclic group """
    axis = np.hstack((np.ones((2000, 1)), np.zeros((2000, 2))))  # x
    angle = np.linspace(-np.pi, np.pi, 2000)
    along_x_axis = AxAngle(np.hstack((axis, angle.reshape(-1, 1))))
    reduced = reduce_to_fundamental_zone(along_x_axis, fz_string)
    assert reduced.data.shape[0] == along_x_axis.data.shape[0]
コード例 #3
0
 def axang(self, good_array):
     return AxAngle(good_array)
コード例 #4
0
 def test_remove_large_rotations(self, good_array):
     axang = AxAngle(good_array)
     axang.remove_large_rotations(1.05)  # removes 1 rotations
     assert axang.data.shape == (1, 4)
コード例 #5
0
 def test_good_array__init__(self, good_array):
     assert isinstance(AxAngle(good_array), AxAngle)
コード例 #6
0
 def test_odd_convention_mat2euler(self):
     ax = AxAngle(np.asarray([[1, 0, 0, 0.2]]))
     ax.to_Euler(axis_convention='sxyz')