def test_frame_rotations_for_mean_of_date(): ts = api.load.timescale() t = ts.utc(2020, 11, 21) p = ICRF((1.1, 1.2, 1.3), t=t) lat, lon, distance1 = p.frame_latlon(true_equator_and_equinox_of_date) # Verify that the frame_latlon() coordinates match those from the # more conventional radec() call. ra, dec, distance2 = p.radec(epoch='date') assert abs(lat.arcseconds() - dec.arcseconds()) < 1e-6 assert abs(lon.arcseconds() - ra.arcseconds()) < 1e-6 assert abs(distance1.au - distance2.au) < 1e-15 # Now that we know the coordinates are good, we can use them to # rebuild a trusted x,y,z vector with which to test frame_xyz(). x1, y1, z1 = from_spherical(distance1.au, lat.radians, lon.radians) x2, y2, z2 = p.frame_xyz(true_equator_and_equinox_of_date).au assert abs(x1 - x2) < 1e-15 assert abs(y1 - y2) < 1e-15 assert abs(z1 - z2) < 1e-15
def test_right(): dx, dy, dz = from_spherical(1, 0, 0) - [1, 0, 0] assert abs(dx) < 1e-15 assert abs(dy) < 1e-15 assert abs(dz) < 1e-15
def test_left_up(): sqrt2 = 0.5**0.5 dx, dy, dz = from_spherical(1, 0.125 * tau, 0.5 * tau) - [-sqrt2, 0, sqrt2] assert abs(dx) < 1e-15 assert abs(dy) < 1e-15 assert abs(dz) < 1e-15
def test_up(): dx, dy, dz = from_spherical(1, 0.25 * tau, 0) - [0, 0, 1] assert abs(dx) < 1e-15 assert abs(dy) < 1e-15 assert abs(dz) < 1e-15
def test_down(): dx, dy, dz = from_spherical(1, 0, 0.75 * tau) - [0, -1, 0] assert abs(dx) < 1e-15 assert abs(dy) < 1e-15 assert abs(dz) < 1e-15