|
7 | 7 | from astropy.coordinates import spherical_to_cartesian
|
8 | 8 | from astropy.tests.helper import assert_quantity_allclose
|
9 | 9 | import astropy.units as u
|
| 10 | +from astropy.coordinates import Angle |
10 | 11 | from astropy.utils.exceptions import AstropyDeprecationWarning
|
11 | 12 |
|
12 | 13 | from ... import jplhorizons
|
13 | 14 |
|
14 | 15 |
|
15 | 16 | @pytest.mark.remote_data
|
16 | 17 | class TestHorizonsClass:
|
17 |
| - |
18 | 18 | def test_ephemerides_query(self):
|
19 |
| - # check values of Ceres for a given epoch |
20 |
| - # orbital uncertainty of Ceres is basically zero |
21 |
| - res = jplhorizons.Horizons(id='Ceres', location='500', |
22 |
| - id_type='smallbody', |
23 |
| - epochs=2451544.5).ephemerides()[0] |
24 |
| - |
25 |
| - assert res['targetname'] == "1 Ceres (A801 AA)" |
26 |
| - assert res['datetime_str'] == "2000-Jan-01 00:00:00.000" |
27 |
| - assert res['solar_presence'] == "" |
28 |
| - assert res['lunar_presence'] == "" |
29 |
| - assert res['elongFlag'] == '/L' |
30 |
| - assert res['airmass'] == 999 |
31 |
| - |
32 |
| - assert is_masked(res['AZ']) |
33 |
| - assert is_masked(res['EL']) |
34 |
| - assert is_masked(res['magextinct']) |
35 |
| - |
36 |
| - assert_quantity_allclose( |
37 |
| - [2451544.5, |
38 |
| - 3.33, .120, |
39 |
| - 188.7028, 9.09829, 34.40955, -2.68359, |
40 |
| - 96.17083, |
41 |
| - 161.3828, 10.4528, 2.551099027865, 0.1744491, |
42 |
| - 2.26315121010004, -21.9390512, 18.82205467, |
43 |
| - 95.3996, 22.5698, 292.551, |
44 |
| - 296.85, |
45 |
| - 184.3426241, 11.7996517, 289.864335, |
46 |
| - 71.545654, |
47 |
| - 0.0, 0.0], |
48 |
| - [res['datetime_jd'], |
49 |
| - res['H'], res['G'], |
50 |
| - res['RA'], res['DEC'], res['RA_rate'], res['DEC_rate'], |
51 |
| - res['illumination'], |
52 |
| - res['EclLon'], res['EclLat'], res['r'], res['r_rate'], |
53 |
| - res['delta'], res['delta_rate'], res['lighttime'], |
54 |
| - res['elong'], res['alpha'], res['sunTargetPA'], |
55 |
| - res['velocityPA'], |
56 |
| - res['ObsEclLon'], res['ObsEclLat'], res['GlxLon'], |
57 |
| - res['GlxLat'], |
58 |
| - res['RA_3sigma'], res['DEC_3sigma']], rtol=1e-3) |
59 |
| - |
60 |
| - # V and surfbright tend to vary a lot more than the others. Give them a |
61 |
| - # more generous test: |
62 |
| - assert_quantity_allclose([8.239, 6.779], [res['V'], res['surfbright']], rtol=0.1) |
| 19 | + # check all values of Ceres for a given epoch |
| 20 | + quantities = ",".join(str(q) for q in range(1, 49)) |
| 21 | + horizons = jplhorizons.Horizons( |
| 22 | + id="Ceres", location="I41", id_type="smallbody", epochs=2451544.5 |
| 23 | + ) |
| 24 | + res = horizons.ephemerides(quantities=quantities) |
| 25 | + |
| 26 | + # Retrieved 2023 Aug 01: |
| 27 | + values = { |
| 28 | + "targetname": "1 Ceres (A801 AA)", |
| 29 | + "H": 3.33, |
| 30 | + "G": 0.120, |
| 31 | + "datetime_jd": 2451544.5, |
| 32 | + "datetime_str": "2000-Jan-01 00:00:00.000", |
| 33 | + "solar_presence": "*", |
| 34 | + "lunar_presence": "", |
| 35 | + "RA": 188.70240 * u.deg, |
| 36 | + "DEC": 9.09758 * u.deg, |
| 37 | + "RA_app": 188.69858 * u.deg, |
| 38 | + "DEC_app": 9.09806 * u.deg, |
| 39 | + "RA_rate": 35.17815 * u.arcsec / u.hr, |
| 40 | + "DEC_rate": -2.74237 * u.arcsec / u.hr, |
| 41 | + "AZ": 325.548736 * u.deg, |
| 42 | + "EL": -41.062749 * u.deg, |
| 43 | + "AZ_rate": 781.92 * u.arcsec / u.minute, |
| 44 | + "EL_rate": -426.18 * u.arcsec / u.minute, |
| 45 | + "sat_X": -304791.02 * u.arcsec, |
| 46 | + "sat_Y": 115814.995 * u.arcsec, |
| 47 | + "sat_PANG": 277.607 * u.deg, |
| 48 | + "siderealtime": 22.8737254836 * u.hr, |
| 49 | + "airmass": 999, |
| 50 | + "magextinct": np.ma.masked, |
| 51 | + "V": 8.259 * u.mag, |
| 52 | + "surfbright": 6.799 * u.mag / u.arcsec**2, |
| 53 | + "illumination": 96.17086 * u.percent, |
| 54 | + "illum_defect": 0.0225 * u.arcsec, |
| 55 | + "sat_sep": 343433.5 * u.arcsec, |
| 56 | + "sat_vis": "*", |
| 57 | + "ang_width": 0.587419 * u.arcsec, |
| 58 | + "PDObsLon": 302.274926 * u.deg, |
| 59 | + "PDObsLat": -3.982640 * u.deg, |
| 60 | + "PDSunLon": 279.670960 * u.deg, |
| 61 | + "PDSunLat": -3.621151 * u.deg, |
| 62 | + "SubSol_ang": 112.55 * u.deg, |
| 63 | + "SubSol_dist": 0.11 * u.arcsec, |
| 64 | + "NPole_ang": 22.6777 * u.deg, |
| 65 | + "NPole_dist": -0.271 * u.arcsec, |
| 66 | + "EclLon": 161.3828 * u.deg, |
| 67 | + "EclLat": 10.4528 * u.deg, |
| 68 | + "r": 2.551099025883 * u.au, |
| 69 | + "r_rate": 0.1744491 * u.km / u.s, |
| 70 | + "delta": 2.26317926925737 * u.au, |
| 71 | + "delta_rate": -21.7732311 * u.km / u.s, |
| 72 | + "lighttime": 18.82228803 * u.minute, |
| 73 | + "vel_sun": 19.3602212 * u.km / u.s, |
| 74 | + "vel_obs": 27.0721344 * u.km / u.s, |
| 75 | + "elong": 95.3982 * u.deg, |
| 76 | + "elongFlag": "/L", |
| 77 | + "alpha": 22.5696 * u.deg, |
| 78 | + "lunar_elong": 32.9 * u.deg, |
| 79 | + "lunar_illum": 27.4882 * u.percent, |
| 80 | + "sat_alpha": 62.0400 * u.deg, |
| 81 | + "sunTargetPA": 292.552 * u.deg, |
| 82 | + "velocityPA": 296.849 * u.deg, |
| 83 | + "OrbPlaneAng": -1.53489 * u.deg, |
| 84 | + "constellation": "Vir", |
| 85 | + "TDB-UT": 64.183887 * u.s, |
| 86 | + "ObsEclLon": 184.3424861 * u.deg, |
| 87 | + "ObsEclLat": 11.7988212 * u.deg, |
| 88 | + "NPole_RA": 291.42763 * u.deg, |
| 89 | + "NPole_DEC": 66.76033 * u.deg, |
| 90 | + "GlxLon": 289.863376 * u.deg, |
| 91 | + "GlxLat": 71.544870 * u.deg, |
| 92 | + "solartime": 16.1587871790 * u.hour, |
| 93 | + "earth_lighttime": 0.000354 * u.minute, |
| 94 | + "RA_3sigma": 0.000 * u.arcsec, |
| 95 | + "DEC_3sigma": 0.000 * u.arcsec, |
| 96 | + "SMAA_3sigma": 0.00012 * u.arcsec, |
| 97 | + "SMIA_3sigma": 0.00005 * u.arcsec, |
| 98 | + "Theta_3sigma": -24.786 * u.deg, |
| 99 | + "Area_3sigma": 0.0000000 * u.arcsec**2, |
| 100 | + "RSS_3sigma": 0.000 * u.arcsec, |
| 101 | + "r_3sigma": 0.0904 * u.km, |
| 102 | + "r_rate_3sigma": 0.0000000 * u.km / u.s, |
| 103 | + "SBand_3sigma": 0.00 * u.Hz, |
| 104 | + "XBand_3sigma": 0.00 * u.Hz, |
| 105 | + "DoppDelay_3sigma": 0.000001 * u.s, |
| 106 | + "true_anom": 7.1181 * u.deg, |
| 107 | + "hour_angle": 10.293820034 * u.hour, |
| 108 | + "alpha_true": 22.5691 * u.deg, |
| 109 | + "PABLon": 172.8355 * u.deg, |
| 110 | + "PABLat": 11.3478 * u.deg, |
| 111 | + "App_Lon_Sun": 309.1603680 * u.deg, |
| 112 | + "RA_ICRF_app": 188.70238 * u.deg, |
| 113 | + "DEC_ICRF_app": 9.09628 * u.deg, |
| 114 | + "RA_ICRF_rate_app": 35.17809 * u.arcsec / u.hour, |
| 115 | + "DEC_ICRF_rate_app": -2.74321 * u.arcsec / u.hour, |
| 116 | + "Sky_motion": 0.5880814 * u.arcsec / u.minute, |
| 117 | + "Sky_mot_PA": 94.457576 * u.deg, |
| 118 | + "RelVel-ANG": -53.53947 * u.deg, |
| 119 | + "Lun_Sky_Brt": np.ma.masked, |
| 120 | + "sky_SNR": np.ma.masked, |
| 121 | + } |
| 122 | + |
| 123 | + # the ephemeris changes with Ceres's and the planets' orbital elements, |
| 124 | + # which can be updated at any time, so only check for 0.1% tolerance, this |
| 125 | + # is enough to verify that most columns are not being confused, and that |
| 126 | + # units are correct |
| 127 | + |
| 128 | + for column, value in values.items(): |
| 129 | + if isinstance(value, (u.Quantity, Angle)): |
| 130 | + # A few columns have varied a lot more than the others |
| 131 | + if column in ["H", "G", "V", "surfbright"]: |
| 132 | + rtol = 0.1 |
| 133 | + else: |
| 134 | + rtol = 0.001 |
| 135 | + assert u.isclose(res[column], value, rtol=rtol) |
| 136 | + elif value is np.ma.masked: |
| 137 | + assert is_masked(res[column]) |
| 138 | + else: |
| 139 | + assert res[column] == value |
63 | 140 |
|
64 | 141 | def test_ephemerides_query_two(self):
|
65 | 142 | # check comet ephemerides using options
|
|
0 commit comments