1
- .. doctest-skip-all
2
-
3
1
.. _astroquery.jplhorizons :
4
2
5
3
***********************************************************************************
@@ -36,6 +34,7 @@ In order to query information for a specific Solar System body, a
36
34
``Horizons `` object has to be instantiated:
37
35
38
36
.. code-block :: python
37
+ .. doctest-remote-data ::
39
38
40
39
>>> from astroquery.jplhorizons import Horizons
41
40
>>> obj = Horizons(id = ' Ceres' , location = ' 568' , epochs = 2458133.33546 )
@@ -62,17 +61,19 @@ location is on Earth if it has not been specifically set. The following example
62
61
uses the coordinates of the `Statue of Liberty
63
62
<https://www.google.com/maps/place/Statue+of+Liberty+National+Monument/@40.6892534,-74.0466891,17z/data=!3m1!4b1!4m5!3m4!1s0x89c25090129c363d:0x40c6a5770d25022b!8m2!3d40.6892494!4d-74.0445004> `_
64
63
as the observer's location:
64
+ .. code-block :: python
65
+ .. doctest-remote-data ::
65
66
66
67
>>> statue_of_liberty = {' lon' : - 74.0466891 ,
67
68
... ' lat' : 40.6892534 ,
68
69
... ' elevation' : 0.093 }
69
70
>>> obj = Horizons(id = ' Ceres' ,
70
71
... location= statue_of_liberty,
71
72
... epochs= 2458133.33546 )
73
+ >>> print (obj)
72
74
JPLHorizons instance "Ceres"; location={'lon': -74.0466891, 'lat': 40.6892534, 'elevation': 0.093}, epochs=[2458133.33546], id_type=None
73
75
74
76
75
-
76
77
``epochs `` is either a scalar or list of Julian dates (floats or strings) in the
77
78
case of discrete epochs, or, in the case of a range of epochs, a dictionary that
78
79
has to include the keywords ``start ``, ``stop `` (both using the following format
@@ -105,7 +106,9 @@ In the case of ambiguities in the name resolution, a list of matching objects
105
106
will be provided. In order to select an object from this list, provide the
106
107
respective id number or record number as ``id `` and use ``id_type=None ``:
107
108
109
+
108
110
.. code-block :: python
111
+ .. doctest-remote-data ::
109
112
110
113
>>> from astroquery.jplhorizons import Horizons
111
114
>>> print (Horizons(id = ' Encke' ).ephemerides())
@@ -142,6 +145,7 @@ for a given observer location (``location``) and epoch or range of epochs
142
145
ephemerides of asteroid (1) Ceres for a range of dates as seen from Mauna Kea:
143
146
144
147
.. code-block :: python
148
+ .. doctest-remote-data ::
145
149
146
150
>>> from astroquery.jplhorizons import Horizons
147
151
>>> obj = Horizons(id = ' Ceres' , location = ' 568' ,
@@ -158,12 +162,7 @@ ephemerides of asteroid (1) Ceres for a range of dates as seen from Mauna Kea:
158
162
1 Ceres 2010-Jan-31 00:00 2455227.5 ... 13.97264 0.0 0.0
159
163
1 Ceres 2010-Feb-10 00:00 2455237.5 ... 10.877201 0.0 0.0
160
164
1 Ceres 2010-Feb-20 00:00 2455247.5 ... 7.976737 0.0 0.0
161
-
162
-
163
- The following fields are available for each ephemerides query:
164
-
165
- .. code-block :: python
166
-
165
+ >>> # The following fields are available for each ephemerides query:
167
166
>>> print (eph.columns)
168
167
<TableColumns names=('targetname','datetime_str','datetime_jd','H','G','solar_presence','flags','RA','DEC','RA_app','DEC_app','RA_rate','DEC_rate','AZ','EL','AZ_rate','EL_rate','sat_X','sat_Y','sat_PANG','siderealtime','airmass','magextinct','V','surfbright','illumination','illum_defect','sat_sep','sat_vis','ang_width','PDObsLon','PDObsLat','PDSunLon','PDSunLat','SubSol_ang','SubSol_dist','NPole_ang','NPole_dist','EclLon','EclLat','r','r_rate','delta','delta_rate','lighttime','vel_sun','vel_obs','elong','elongFlag','alpha','lunar_elong','lunar_illum','sat_alpha','sunTargetPA','velocityPA','OrbPlaneAng','constellation','TDB-UT','ObsEclLon','ObsEclLat','NPole_RA','NPole_DEC','GlxLon','GlxLat','solartime','earth_lighttime','RA_3sigma','DEC_3sigma','SMAA_3sigma','SMIA_3sigma','Theta_3sigma','Area_3sigma','RSS_3sigma','r_3sigma','r_rate_3sigma','SBand_3sigma','XBand_3sigma','DoppDelay_3sigma','true_anom','hour_angle','alpha_true','PABLon','PABLat')>
169
168
@@ -215,6 +214,7 @@ an astropy table. The following example queries the osculating elements of
215
214
asteroid (433) Eros for a given date relative to the Sun:
216
215
217
216
.. code-block :: python
217
+ .. doctest-remote-data ::
218
218
219
219
>>> from astroquery.jplhorizons import Horizons
220
220
>>> obj = Horizons(id = ' 433' , location = ' 500@10' ,
@@ -225,12 +225,7 @@ asteroid (433) Eros for a given date relative to the Sun:
225
225
--- d ... AU d
226
226
------------------ ------------- ... ------------- ------------
227
227
433 Eros (A898 PA) 2458133.33546 ... 1.78244263804 642.93873484
228
-
229
-
230
- The following fields are queried:
231
-
232
- .. code-block :: python
233
-
228
+ >>> # The following fields are queried:
234
229
>>> print (el.columns)
235
230
<TableColumns names=('targetname','datetime_jd','datetime_str','H','G','e','q','incl','Omega','w','Tp_jd','n','M','nu','a','Q','P')>
236
231
@@ -258,6 +253,7 @@ vector of asteroid 2012 TC4 as seen from Goldstone for a range of
258
253
epochs:
259
254
260
255
.. code-block :: python
256
+ .. doctest-remote-data ::
261
257
262
258
>>> from astroquery.jplhorizons import Horizons
263
259
>>> obj = Horizons(id = ' 2012 TC4' , location = ' 257' ,
@@ -283,9 +279,7 @@ epochs:
283
279
(2012 TC4) 2458028.49306 ... 0.0391079696711 -0.0040635698239
284
280
(2012 TC4) 2458028.5 ... 0.0390797485422 -0.00406404543822
285
281
Length = 145 rows
286
-
287
- The following fields are queried:
288
-
282
+ >>> # The following fields are queried:
289
283
>>> print (vec.columns)
290
284
<TableColumns names=('targetname','datetime_jd','datetime_str','H','G','x','y','z','vx','vy','vz','lighttime','range','range_rate')>
291
285
@@ -315,18 +309,15 @@ JPL Horizons ephemerides query of near-Earth asteroid (3552) Don Quixote since
315
309
its year of Discovery:
316
310
317
311
.. code-block :: python
312
+ .. doctest-remote-data ::
318
313
319
314
>>> from astroquery.jplhorizons import Horizons
320
315
>>> obj = Horizons(id = ' 3552' , location = ' 568' ,
321
316
... epochs= {' start' :' 2010-01-01' , ' stop' :' 2019-12-31' ,
322
317
... ' step' :' 1y' })
323
318
>>> eph = obj.ephemerides()
324
-
325
- As we have seen before, we can display a truncated version of table
326
- ``eph `` by simply using
327
-
328
- .. code-block :: python
329
-
319
+ >>> # As we have seen before, we can display a truncated version of table
320
+ >>> # ``eph`` by simply using
330
321
>>> print (eph)
331
322
targetname datetime_str ... PABLon PABLat
332
323
--- --- ... deg deg
@@ -356,16 +347,17 @@ We can get at list of all the columns in this table with:
356
347
357
348
.. code-block :: python
358
349
359
- >> > print (eph.columns)
360
- < TableColumns names= (' targetname' ,' datetime_str' ,' datetime_jd' ,' H' ,' G' ,' solar_presence' ,' flags' ,' RA' ,' DEC' ,' RA_app' ,' DEC_app' ,' RA_rate' ,' DEC_rate' ,' AZ' ,' EL' ,' AZ_rate' ,' EL_rate' ,' sat_X' ,' sat_Y' ,' sat_PANG' ,' siderealtime' ,' airmass' ,' magextinct' ,' V' ,' surfbright' ,' illumination' ,' illum_defect' ,' sat_sep' ,' sat_vis' ,' ang_width' ,' PDObsLon' ,' PDObsLat' ,' PDSunLon' ,' PDSunLat' ,' SubSol_ang' ,' SubSol_dist' ,' NPole_ang' ,' NPole_dist' ,' EclLon' ,' EclLat' ,' r' ,' r_rate' ,' delta' ,' delta_rate' ,' lighttime' ,' vel_sun' ,' vel_obs' ,' elong' ,' elongFlag' ,' alpha' ,' lunar_elong' ,' lunar_illum' ,' sat_alpha' ,' sunTargetPA' ,' velocityPA' ,' OrbPlaneAng' ,' constellation' ,' TDB-UT' ,' ObsEclLon' ,' ObsEclLat' ,' NPole_RA' ,' NPole_DEC' ,' GlxLon' ,' GlxLat' ,' solartime' ,' earth_lighttime' ,' RA_3sigma' ,' DEC_3sigma' ,' SMAA_3sigma' ,' SMIA_3sigma' ,' Theta_3sigma' ,' Area_3sigma' ,' RSS_3sigma' ,' r_3sigma' ,' r_rate_3sigma' ,' SBand_3sigma' ,' XBand_3sigma' ,' DoppDelay_3sigma' ,' true_anom' ,' hour_angle' ,' alpha_true' ,' PABLon' ,' PABLat' )>
350
+ >> > print (eph.columns) # doctest: +REMOTE_DATA
351
+ < TableColumns names= (' targetname' ,' datetime_str' ,' datetime_jd' ,' H' ,' G' ,' solar_presence' ,' flags' ,' RA' ,' DEC' ,' RA_rate' ,' DEC_rate' ,' AZ' ,' EL' ,' airmass' ,' magextinct' ,' V' ,' surfbright' ,' illumination' ,' EclLon' ,' EclLat' ,' r' ,' r_rate' ,' delta' ,' delta_rate' ,' lighttime' ,' elong' ,' elongFlag' ,' alpha' ,' sunTargetPA' ,' velocityPA' ,' ObsEclLon' ,' ObsEclLat' ,' GlxLon' ,' GlxLat' ,' RA_3sigma' ,' DEC_3sigma' )>
352
+
361
353
362
354
We can address each column individually by indexing it using its name as
363
355
provided in this list. For instance, we can get all RAs for Don Quixote by using
364
356
365
357
.. code-block :: python
366
358
367
- >> > print (eph[' RA' ])
368
- RA
359
+ >> > print (eph[' RA' ]) # doctest: +REMOTE_DATA
360
+ RA
369
361
deg
370
362
-------- -
371
363
345.50204
@@ -385,27 +377,34 @@ We can select several columns at a time, for instance RA and DEC for each epoch
385
377
386
378
.. code-block :: python
387
379
388
- >> > print (eph[' datetime_str' , ' RA' , ' DEC' ])
389
- datetime_str RA DEC
390
- -- - deg deg
391
- ---------------- - -------- - --------
392
- 2010 - Jan- 01 00 :00 345.50204 13.43621
393
- 2011 - Jan- 01 00 :00 78.77158 61.48831
394
- 2012 - Jan- 01 00 :00 119.85659 54.21955
395
- 2013 - Jan- 01 00 :00 136.60021 45.82409
396
- 2014 - Jan- 01 00 :00 147.44947 37.79876
397
- 2015 - Jan- 01 00 :00 156.58967 29.23058
398
- 2016 - Jan- 01 00 :00 166.32129 18.48174
399
- 2017 - Jan- 01 00 :00 180.6992 1.20453
400
- 2018 - Jan- 01 00 :00 232.11974 - 37.9554
401
- 2019 - Jan- 01 00 :00 16.1066 45.50296
380
+ >> > print (eph[' datetime_str' , ' RA' , ' DEC' ]) # doctest: +REMOTE_DATA
381
+ datetime_str RA DEC
382
+ -- - deg deg
383
+ ---------------- - -------- - -------- -
384
+ 1983 - Jan- 01 00 :00 209.43762 - 25.92118
385
+ 1984 - Jan- 01 00 :00 357.85696 28.74791
386
+ 1985 - Jan- 01 00 :00 86.22996 60.90524
387
+ 1986 - Jan- 01 00 :00 122.10393 53.19306
388
+ 1987 - Jan- 01 00 :00 137.91137 44.95184
389
+ 1988 - Jan- 01 00 :00 148.42444 37.01774
390
+ ... ... ...
391
+ 2013 - Jan- 01 00 :00 136.60019 45.82408
392
+ 2014 - Jan- 01 00 :00 147.44945 37.79874
393
+ 2015 - Jan- 01 00 :00 156.58965 29.23058
394
+ 2016 - Jan- 01 00 :00 166.32128 18.48173
395
+ 2017 - Jan- 01 00 :00 180.69918 1.20453
396
+ 2018 - Jan- 01 00 :00 232.11974 - 37.95539
397
+ 2019 - Jan- 01 00 :00 16.10662 45.50296
398
+ Length = 37 rows
402
399
403
400
404
401
We can use the same representation to do math with these columns. For instance,
405
402
let's calculate the total rate of the object by summing 'RA_rate' and 'DEC_rate'
406
403
in quadrature:
407
404
405
+
408
406
.. code-block :: python
407
+ .. doctest-remote-data ::
409
408
410
409
>>> import numpy as np
411
410
>>> print (np.sqrt(eph[' RA_rate' ]** 2 + eph[' DEC_rate' ]** 2 ))
@@ -435,6 +434,7 @@ available, too, e.g., the ``RA_rate`` column is expressed in ``arcsec /
435
434
h `` - arcseconds per hour:
436
435
437
436
.. code-block :: python
437
+ .. doctest-remote-data ::
438
438
439
439
>>> print (eph[' RA_rate' ])
440
440
RA_rate
@@ -456,6 +456,7 @@ The unit of this column can be easily converted to any other unit describing the
456
456
same dimensions. For instance, we can turn ``RA_rate `` into ``arcsec / s ``:
457
457
458
458
.. code-block :: python
459
+ .. doctest-remote-data ::
459
460
460
461
>>> eph[' RA_rate' ].convert_unit_to(' arcsec/s' )
461
462
>>> print (eph[' RA_rate' ])
@@ -493,8 +494,8 @@ Horizons server can be obtained from the
493
494
:class: `~astroquery.jplhorizons.HorizonsClass ` object after a query has been
494
495
performed (before the query only ``None `` would be returned):
495
496
496
- >>> print (obj.uri)
497
- https://ssd.jpl.nasa.gov/api/horizons.api?format=text&EPHEM_TYPE=OBSERVER&QUANTITIES=%271%2C2%2C3%2C4%2C5%2C6%2C7%2C8%2C9%2C10%2C11%2C12%2C13%2C14%2C15%2C16%2C17%2C18%2C19%2C20%2C21%2C22%2C23%2C24%2C25%2C26%2C27%2C28%2C29%2C30%2C31%2C32%2C33%2C34%2C35%2C36%2C37%2C38%2C39%2C40%2C41%2C42%2C43%27 &COMMAND=%223552% 22&SOLAR_ELONG=%220%2C180%22&LHA_CUTOFF=0& CSV_FORMAT=YES&CAL_FORMAT=BOTH&ANG_FORMAT=DEG&APPARENT=AIRLESS&REF_SYSTEM=ICRF&EXTRA_PREC=NO&CENTER=%27568%27& START_TIME=%222010-01 -01%22 &STOP_TIME=%222019-12-31%22 &STEP_SIZE=%221y%22&SKIP_DAYLT=NO
497
+ >>> print (obj.uri) # doctest: +REMOTE_DATA
498
+ https://ssd.jpl.nasa.gov/horizons_batch.cgi?batch=1&TABLE_TYPE=VECTORS&OUT_UNITS=AU-D &COMMAND=%222012+TC4%3B% 22&CENTER=%27257%27& CSV_FORMAT=%22YES%22&REF_PLANE=ECLIPTIC&REF_SYSTEM=J2000&TP_TYPE=ABSOLUTE&LABELS=YES&OBJ_DATA=YES& START_TIME=2017-10 -01&STOP_TIME=2017-10-02 &STEP_SIZE=10m
498
499
499
500
If your query failed, it might be useful for you to put the URI into a web
500
501
browser to get more information why it failed. Please note that ``uri `` is an
0 commit comments