There is one now! I've just run across the python package callhorizons in github and Python Package Index.
There is more information in readthedocis.io which helps explain how to do queries if you are looking for asteroids/minor bodies, for which there are zillions and the names can be people's name, or alphanumerics.
I'll try to test it further and update here. It looks like there is a lot of capability here, but I can't say for sure yet. There is a blog post by an astronomer but it's from January 2016.
It was a one-line install, namely pip install callhorizons
. I then typed in the simple demo at the top of the PyPI page and got an answer!
>>> import callhorizons
>>> eros = callhorizons.query('Eros')
>>> eros.set_discreteepochs([2457446.177083, 2457446.182343])
>>> eros.get_ephemerides(568)
2
>>> print(eros['RA'], eros['DEC'])
(array([ 292.46003, 292.46332]), array([-27.44392, -27.44335]))
>>>
Yay python!
The current version is a pure python script, and contains the comment:
CALLHORIZONS - a Python interface to access JPL HORIZONS
ephemerides and orbital elements.
This module provides a convenient python interface to the JPL
HORIZONS system by directly accessing and parsing the HORIZONS
website. Ephemerides can be obtained through get_ephemerides,
orbital elements through get_elements. Function
export2pyephem provides an interface to the PyEphem module.
michael.mommert (at) nau.edu, latest version: v1.0.5, 2017-05-05.
This code is inspired by code created by Alex Hagen.
Currently it only generates the query url for an observer table, not state vectors, but it could certainly be easily customized to get state vectors. Here is a small chunk, additional parameters are added to the url string before it's used.
### construct URL for HORIZONS query
url = "http://ssd.jpl.nasa.gov/horizons_batch.cgi?batch=l" \
+ "&TABLE_TYPE='OBSERVER'" \
+ "&QUANTITIES='" + str(quantities) + "'" \
+ "&CSV_FORMAT='YES'" \
+ "&ANG_FORMAT='DEG'" \
+ "&CAL_FORMAT='BOTH'" \
+ "&SOLAR_ELONG='" + str(solar_elongation[0]) + "," \
+ str(solar_elongation[1]) + "'" \
+ "&CENTER='"+str(observatory_code)+"'"
OK try a spacecraft, also viewed from Mauna Kea. From JPL Horizons with the following setup:
gives (scrolls horizontally):
**********************************************************************************************************************************
Date_________JDUT, , ,R.A._(ICRF/J2000.0), DEC_(ICRF/J2000.0), APmag, S-brt, delta, deldot, S-O-T,/r, S-T-O,
**********************************************************************************************************************************
$$SOE
2457754.500000000,*,m,20 01 24.54,-56 59 28.4, n.a., n.a., 1.7047550022E+10, 18.9796569, 36.6514,/T, 0.2976,
2457784.500000000,*,m,20 03 22.69,-56 58 00.2, n.a., n.a., 1.7080283550E+10, 6.5439542, 40.6419,/L, 0.3218,
2457814.500000000,*,m,20 05 08.36,-57 01 24.2, n.a., n.a., 1.7082950019E+10, -3.4910462, 59.2751,/L, 0.4270,
2457844.500000000,*,m,20 06 16.02,-57 09 10.1, n.a., n.a., 1.7065586218E+10, -8.4792450, 82.4692,/L, 0.4975,
2457874.500000000,*,m,20 06 30.25,-57 19 39.5, n.a., n.a., 1.7043227392E+10, -7.3046878, 106.0860,/L, 0.4870,
2457904.500000000,*,m,20 05 49.21,-57 30 32.2, n.a., n.a., 1.7031649793E+10, -0.4854246, 127.5819,/L, 0.4048,
2457934.500000000,*,m,20 04 24.98,-57 39 21.6, n.a., n.a., 1.7043463848E+10, 10.1577911, 141.9907,/L, 0.3144,
$$EOE
**********************************************************************************************************************************
Compare to this script:
import callhorizons
import numpy as np
JDs = [2457754.5 + 30*i for i in range(7)] # 01-Jan-2017 00:00 UTC + n*30 days
V2 = callhorizons.query(-32, smallbody=False) # -32 for Voyager 2
V2.set_discreteepochs(JDs)
V2.get_ephemerides(568) # 568 for Mauna Kea
radecs = np.vstack((V2['RA'], V2['DEC']))
for JD, radec in zip(JDs, radecs.T):
print JD, radec
A spot check shows that these are the same, great! Fyi the very large apparent motion is due to parallax - the Earth shifting its perspective every month. After one year the position actually only changes by a few tenths of a degree.
2457754.5 [ 300.35226 -56.99121]
2457784.5 [ 300.84454 -56.96671]
2457814.5 [ 301.28482 -57.0234 ]
2457844.5 [ 301.56676 -57.1528 ]
2457874.5 [ 301.62605 -57.32765]
2457904.5 [ 301.45504 -57.50895]
2457934.5 [ 301.10407 -57.65601]
python
tag is critical there. $\endgroup$telnetlib
to access the telnet interface? $\endgroup$