def test_pvr_valid_dcm(): dcm1 = ut.random_dcm() angle, e = tr.dcm_to_prv(dcm1) dcm2 = tr.prv_to_dcm(angle, e) np.testing.assert_almost_equal(dcm2 @ dcm2.T, np.identity(3)) np.testing.assert_almost_equal(np.linalg.det(dcm2), 1) for i in (0, 1, 2): np.testing.assert_almost_equal(np.linalg.norm(dcm2[i]), 1) np.testing.assert_almost_equal(np.linalg.norm(dcm2[:, i]), 1)
def get_prvs(data): angle = np.zeros(len(time)) e = np.zeros((len(time), 3)) for i in range(len(time)): angle[i], e[i] = tr.dcm_to_prv(tr.mrp_to_dcm(data[i])) return angle, e
def test_pvr_reverse(): dcm1 = ut.random_dcm() angle, e = tr.dcm_to_prv(dcm1) dcm2 = tr.prv_to_dcm(angle, e) np.testing.assert_almost_equal(dcm1, dcm2)