15
15
16
16
@pytest .mark .remote_data
17
17
class TestHorizonsClass :
18
-
19
18
def test_ephemerides_query (self ):
20
19
# check all values of Ceres for a given epoch
21
- # orbital uncertainty of Ceres is basically zero
22
- res = jplhorizons .Horizons (id = 'Ceres' , location = 'I41' ,
23
- id_type = 'smallbody' ,
24
- epochs = 2451544.5 ,
25
- quantities = "," .join (str (q ) for q in range (1 , 49 ))
26
- ).ephemerides ()[0 ]
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 )
27
25
28
26
# Retrieved 2023 Aug 01:
29
27
values = {
28
+ "targetname" : "1 Ceres (A801 AA)" ,
29
+ "H" : 3.33 ,
30
+ "G" : 0.120 ,
31
+ "datetime_jd" : 2451544.5 ,
30
32
"datetime_str" : "2000-Jan-01 00:00:00.000" ,
31
33
"solar_presence" : "*" ,
32
34
"lunar_presence" : "" ,
33
- "RA" : Angle ( "12 34 48.58" , unit = "hr" ) ,
34
- "DEC" : Angle ( "+09 05 51.3" , unit = " deg" ) ,
35
- "RA_app" : Angle ( "12 34 47.66" , unit = "hr" ) ,
36
- "DEC_app" : Angle ( "+09 05 53.0" , unit = " deg" ) ,
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 ,
37
39
"RA_rate" : 35.17815 * u .arcsec / u .hr ,
38
40
"DEC_rate" : - 2.74237 * u .arcsec / u .hr ,
39
41
"AZ" : 325.548736 * u .deg ,
@@ -43,7 +45,7 @@ def test_ephemerides_query(self):
43
45
"sat_X" : - 304791.02 * u .arcsec ,
44
46
"sat_Y" : 115814.995 * u .arcsec ,
45
47
"sat_PANG" : 277.607 * u .deg ,
46
- "siderealtime" : "22 52 25.4117" ,
48
+ "siderealtime" : 22.8737254836 * u . hr ,
47
49
"airmass" : 999 ,
48
50
"magextinct" : np .ma .masked ,
49
51
"V" : 8.259 * u .mag ,
@@ -87,7 +89,7 @@ def test_ephemerides_query(self):
87
89
"NPole_DEC" : 66.76033 * u .deg ,
88
90
"GlxLon" : 289.863376 * u .deg ,
89
91
"GlxLat" : 71.544870 * u .deg ,
90
- "solartime" : "16 09 31.6338" ,
92
+ "solartime" : 16.1587871790 * u . hour ,
91
93
"earth_lighttime" : 0.000354 * u .minute ,
92
94
"RA_3sigma" : 0.000 * u .arcsec ,
93
95
"DEC_3sigma" : 0.000 * u .arcsec ,
@@ -102,74 +104,40 @@ def test_ephemerides_query(self):
102
104
"XBand_3sigma" : 0.00 * u .Hz ,
103
105
"DoppDelay_3sigma" : 0.000001 * u .s ,
104
106
"true_anom" : 7.1181 * u .deg ,
105
- "hour_angle" : "10 17 37.752" ,
107
+ "hour_angle" : 10.293820034 * u . hour ,
106
108
"alpha_true" : 22.5691 * u .deg ,
107
109
"PABLon" : 172.8355 * u .deg ,
108
110
"PABLat" : 11.3478 * u .deg ,
109
111
"App_Lon_Sun" : 309.1603680 * u .deg ,
110
- "RA_ICRF_app" : Angle ( "12 34 48.57" , unit = u . hr ) ,
111
- "DEC_ICRF_app" : Angle ( "+09 05 46.6" , unit = u .deg ) ,
112
+ "RA_ICRF_app" : 188.70238 * u . deg ,
113
+ "DEC_ICRF_app" : 9.09628 * u .deg ,
112
114
"RA_ICRF_rate" : 35.17809 * u .arcsec / u .hour ,
113
115
"DEC_ICRF_rate" : - 2.74321 * u .arcsec / u .hour ,
114
116
"Sky_motion" : 0.5880814 * u .arcsec / u .minute ,
115
117
"Sky_mot_PA" : 94.457576 * u .deg ,
116
118
"RelVel-ANG" : - 53.53947 * u .deg ,
117
- "Lun_Sky_Brt" : np .masked ,
118
- "sky_SNR" : np .masked ,
119
+ "Lun_Sky_Brt" : np .ma . masked ,
120
+ "sky_SNR" : np .ma . masked ,
119
121
}
120
122
121
123
# the ephemeris changes with Ceres's and the planets' orbital elements,
122
- # which can be updated at any time, so only check for 1% tolerance, this
123
- # is enough to verify that columns are not being confused, and that
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
124
126
# units are correct
125
127
126
128
for column , value in values .items ():
127
- if u .isinstance (value , (u .Quantity , u .Angle )):
128
- assert u .isclose (res [column ], value , rtol = 0.001 )
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 )
129
136
elif value is np .ma .masked :
130
137
assert is_masked (res [column ])
131
138
else :
132
139
assert res [column ] == value
133
140
134
- # assert res['targetname'] == "1 Ceres (A801 AA)"
135
- # assert res['datetime_str'] == "2000-Jan-01 00:00:00.000"
136
- # assert res['solar_presence'] == ""
137
- # assert res['lunar_presence'] == ""
138
- # assert res['elongFlag'] == '/L'
139
- # assert res['airmass'] == 999
140
-
141
- # assert is_masked(res['AZ'])
142
- # assert is_masked(res['EL'])
143
- # assert is_masked(res['magextinct'])
144
-
145
- # assert_quantity_allclose(
146
- # [2451544.5,
147
- # 3.33, .120,
148
- # 188.7028, 9.09829, 34.40955, -2.68359,
149
- # 96.17083,
150
- # 161.3828, 10.4528, 2.551099027865, 0.1744491,
151
- # 2.26315121010004, -21.9390512, 18.82205467,
152
- # 95.3996, 22.5698, 292.551,
153
- # 296.85,
154
- # 184.3426241, 11.7996517, 289.864335,
155
- # 71.545654,
156
- # 0.0, 0.0],
157
- # [res['datetime_jd'],
158
- # res['H'], res['G'],
159
- # res['RA'], res['DEC'], res['RA_rate'], res['DEC_rate'],
160
- # res['illumination'],
161
- # res['EclLon'], res['EclLat'], res['r'], res['r_rate'],
162
- # res['delta'], res['delta_rate'], res['lighttime'],
163
- # res['elong'], res['alpha'], res['sunTargetPA'],
164
- # res['velocityPA'],
165
- # res['ObsEclLon'], res['ObsEclLat'], res['GlxLon'],
166
- # res['GlxLat'],
167
- # res['RA_3sigma'], res['DEC_3sigma']], rtol=1e-3)
168
-
169
- # # V and surfbright tend to vary a lot more than the others. Give them a
170
- # # more generous test:
171
- # assert_quantity_allclose([8.239, 6.779], [res['V'], res['surfbright']], rtol=0.1)
172
-
173
141
def test_ephemerides_query_two (self ):
174
142
# check comet ephemerides using options
175
143
obj = jplhorizons .Horizons (id = 'Halley' , id_type = 'comet_name' ,
0 commit comments