def test_icrs_body_position_to_planetary_frame_yields_zeros(body, frame): with solar_system_ephemeris.set("builtin"): epoch = J2000 vector = get_body_barycentric(body.name, epoch) vector_result = (ICRS(vector).transform_to( frame(obstime=epoch)).represent_as(CartesianRepresentation)) assert_quantity_allclose(vector_result.xyz, [0, 0, 0] * u.km, atol=1e-7 * u.km)
def test_planetary_icrs_frame_is_just_translation(body, frame): epoch = J2000 vector = CartesianRepresentation(x=100 * u.km, y=100 * u.km, z=100 * u.km) vector_result = ( frame(vector, obstime=epoch) .transform_to(ICRS()) .represent_as(CartesianRepresentation) ) expected_result = get_body_barycentric(body.name, epoch) + vector assert_quantity_allclose(vector_result.xyz, expected_result.xyz)
def test_orbit_from_ephem_is_in_icrs_frame(body): ss = Orbit.from_body_ephem(body) assert ss.get_frame().is_equivalent_frame(ICRS())