def test_to_llw(): A1 = np.identity(3) llw1 = np.array([90, 0, -90]) assert_allclose(dcm.to_llw(A1), llw1, rtol=1e-10) A2 = np.array([[0, 0, 1], [1, 0, 0], [0, 1, 0]]) llw2 = np.array([0, 0, 0]) assert_allclose(dcm.to_llw(A2), llw2, atol=1e-10) A = np.empty((10, 3, 3)) A[:5] = A1 A[5:] = A2 llw = np.empty((10, 3)) llw[:5] = llw1 llw[5:] = llw2 ret = dcm.to_llw(A) for i in range(3): assert_allclose(ret[i], llw[:, i], rtol=1e-10, atol=1e-10)
def test_dcm_llw_conversion(): rng = np.random.RandomState(0) lat = rng.uniform(-90, 90, 20) lon = rng.uniform(-180, 180, 20) wan = rng.uniform(-180, 180, 20) A = dcm.from_llw(lat, lon, wan) lat_r, lon_r, wan_r = dcm.to_llw(A) assert_allclose(lon_r, lon, rtol=1e-10) assert_allclose(lat_r, lat, rtol=1e-10) assert_allclose(wan_r, wan, rtol=1e-10)
def test_to_llw(): A = np.array([[0, 0, 1], [1, 0, 0], [0, 1, 0]]) llw = np.array([0, 0, 0]) assert_allclose(dcm.to_llw(A), llw, atol=1e-10)