Esempio n. 1
0
def test_angax_pi():
    rot = -np.eye(3)
    rot[1, 1] = 1.
    ang, ax, d = displace.angax(rot)
    assert np.isclose(ang, np.pi)
    assert np.allclose(ax, [0, 1, 0])
    assert np.isclose(d, 1.)
Esempio n. 2
0
def test_angax_pi():
    rot = -np.eye(3)
    rot[1,1] = 1.
    ang, ax, d = displace.angax(rot)
    assert np.isclose(ang, np.pi)
    assert np.allclose(ax, [0, 1, 0])
    assert np.isclose(d, 1.)
Esempio n. 3
0
def test_angax_degrees():
    u = np.ones(3) / np.sqrt(3)
    rot = np.array([[0, u[2], -u[1]], [-u[2], 0, u[0]], [u[1], -u[0], 0]])
    rot += np.outer(u, u)
    ang, ax, d = displace.angax(rot, units='deg')
    assert np.isclose(ang, 90.)
    assert np.allclose(ax, u)
    assert np.isclose(d, 1.)
Esempio n. 4
0
def test_angax_degrees():
    u = np.ones(3) / np.sqrt(3)
    rot = np.array([[0, u[2], -u[1]], [-u[2], 0, u[0]], [u[1], -u[0], 0]])
    rot += np.outer(u, u)
    ang, ax, d = displace.angax(rot, units='deg')
    assert np.isclose(ang, 90.)
    assert np.allclose(ax, u)
    assert np.isclose(d, 1.)
Esempio n. 5
0
def test_angax_det_error():
    with pytest.raises(ValueError, match=r'Determinant of a rotational .*'):
        ang, ax, d = displace.angax(2 * np.eye(3))
Esempio n. 6
0
def test_angax_invert():
    ang, ax, d = displace.angax(-np.eye(3))
    assert np.isclose(ang, np.pi)
    assert np.allclose(ax, [0, 0, 1])
    assert np.isclose(d, -1.)
Esempio n. 7
0
def test_angax_identity():
    ang, ax, d = displace.angax(np.eye(3))
    assert np.isclose(ang, 0.)
    assert np.allclose(ax, [0, 0, 1])
    assert np.isclose(d, 1.)
Esempio n. 8
0
def test_angax_det_error():
    with pytest.raises(ValueError, match=r'Determinant of a rotational .*'):
        ang, ax, d = displace.angax(2*np.eye(3))
Esempio n. 9
0
def test_angax_invert():
    ang, ax, d = displace.angax(-np.eye(3))
    assert np.isclose(ang, np.pi)
    assert np.allclose(ax, [0, 0, 1])
    assert np.isclose(d, -1.)
Esempio n. 10
0
def test_angax_identity():
    ang, ax, d = displace.angax(np.eye(3))
    assert np.isclose(ang, 0.)
    assert np.allclose(ax, [0, 0, 1])
    assert np.isclose(d, 1.)