def test_sun(): """ Test that `get_sun` works and it behaves roughly as it should (in GCRS) """ from astropy.coordinates.funcs import get_sun northern_summer_solstice = Time('2010-6-21') northern_winter_solstice = Time('2010-12-21') equinox_1 = Time('2010-3-21') equinox_2 = Time('2010-9-21') gcrs1 = get_sun(equinox_1) assert np.abs(gcrs1.dec.deg) < 1 gcrs2 = get_sun(Time([northern_summer_solstice, equinox_2, northern_winter_solstice])) assert np.all(np.abs(gcrs2.dec - [23.5, 0, -23.5]*u.deg) < 1*u.deg)
def test_get_sun_consistency(time): """ Test that the sun from JPL and the builtin get_sun match """ sun_jpl_gcrs = get_body('sun', time, ephemeris='de432s') builtin_get_sun = get_sun(time) sep = builtin_get_sun.separation(sun_jpl_gcrs) assert sep < 0.1 * u.arcsec
def test_get_sun_consistency(time): """ Test that the sun from JPL and the builtin get_sun match """ sun_jpl_gcrs = get_body('sun', time, ephemeris='de432s') builtin_get_sun = get_sun(time) sep = builtin_get_sun.separation(sun_jpl_gcrs) assert sep < 0.1*u.arcsec