jplhorizons.horizons_vector

jplhorizons.horizons_vector(
    epochs,
    obsid,
    location=None,
    id_type=None,
    depochs=HORIZONS_DEPOCHS,
    aberrations='geometric',
    refplane='ecliptic',
    spice_units=False,
    invert=False,
    return_arr=False,
    try_spice=False,
    spin=None,
    **kwargs,
)

Get the state vector from JPL Horizons (“vector query”).

Parameters

epochs : scalar, list-like, or dictionary

A numeric TDB Julian date, a sequence of TDB Julian dates in the desired output order, or a dictionary defining a range of times and dates; the range dictionary has to be of the form {'start': ‘YYYY-MM-DD [HH:MM:SS]’, 'stop': ‘YYYY-MM-DD [HH:MM:SS]’, 'step': ‘n[y|d|m|s]’}. Epoch timescales should be TDB for vector queries. If None, Horizons uses the current time. If obsid and location are available as loaded SPK and try_spice is True, epochs must be in JD (units of days).

obsid : str or dict

Name, number, or designation of target object. Uses the same codes as JPL Horizons. Arbitrary topocentric coordinates can be added in a dict. The dict has to be of the form {'lon': longitude in deg (East positive, West negative), 'lat': latitude in deg (North positive, South negative), 'elevation': elevation in km above the reference ellipsoid, ['body': Horizons body ID of the central body; optional; if this value is not provided it is assumed that this location is on Earth]}. Float values are assumed to have units of degrees and kilometers.

location : str or dict, default = None

Center body name (for vector queries). Uses the same codes as JPL Horizons. If None (default), the Sun’s center is used. Arbitrary topocentric coordinates for ephemerides queries can be provided in the format of a dictionary. The dictionary has to be of the form {'lon': longitude (East positive, West negative), 'lat': latitude (North positive, South negative), 'elevation': elevation above the reference ellipsoid, ['body': Horizons body ID of the central body; optional; if this value is not provided it is assumed that this location is on Earth]}. Float values are assumed to have units of degrees and kilometers. Some tips: Sun center is "@10".

id_type : str, default = None

Controls Horizons’s object selection for id [HORIZONSDOC_SELECTION]_ . Options: 'designation' (small body designation), 'name' (asteroid or comet name), 'asteroid_name', 'comet_name', 'smallbody' (asteroid and comet search), or `None``(first search search planets, natural satellites, spacecraft, and special cases, and if no matches, then search small bodies).

depochs : int, default = HORIZONS_DEPOCHS

Number of epochs in a chunk to use for the vector query. This is necessary to avoid “too long URI” errors when epochs is a large list. Default is HORIZONS_DEPOCHS.

aberrations : {'geometric', 'astrometric', 'apparent'}, default = 'geometric'

Aberrations to be accounted for. The local Kete shortcut always returns a geometric state. Use "astrometric" to include light-time correction and thus to compare kete results against Horizons. Default is 'geometric'.

refplane : {'ecliptic', 'earth', 'body'}, default = 'ecliptic'

Reference plane for all output quantities: 'ecliptic' (ecliptic and mean equinox of reference epoch), 'earth' (Earth mean equator and equinox of reference epoch), or 'body' (body mean equator and node of date). Will be converted as {‘ecliptic’: ‘Ecliptic’, ‘earth’: ‘Equatorial’} when obsid and location are available as loaded SPK and try_spice is True.

Default is 'ecliptic'.

See “Horizons Reference Frames” in the astroquery documentation for details.

spice_units : bool, default = False

If True, the output table will be in SPICE units (km for distance and km/s for velocity.). Otherwise, use default JPL Horizons units (au for distance and au/day for velocity, as of writing). Default is False.

invert : bool, default = False

If True, the position and velocity vectors will be inverted. Useful in this case: The user only has the TDB time at the observatory in space far from the NAIF object (e.g., Earth). Then the easiest way to query the state vector of the observatory is to query the vector to the geocenter and invert it. Default is False.

return_arr : bool, default = False

If True, return the state vector components as two numpy arrays (position and velocity), on top of the full table. Default is False.

try_spice : bool, default = False

If True, try local Kete kernels for named or numbered bodies at explicit Julian dates in the ecliptic or equatorial frame. An explicit id_type, a location other than None, "@..." or "500@...", or extra Horizons options select the remote service. Default is False.

spin : ~skyloc.geometry.Pole or ~skyloc.geometry.IAUSpin, default = None

If provided, append sub-solar and sub-observer latitude columns. A complete ~skyloc.geometry.IAUSpin also appends longitude columns and dhour_obs in degrees, using the frozen-Sun rotational convention of ~skyloc.geometry.calc_subpoints. refplane="body" is not supported with spin geometry.

**kwargs : dict

Additional keyword arguments to pass to ~astroquery.jplhorizons.Horizons.vectors. See https://astroquery.readthedocs.io/en/latest/api/astroquery.jplhorizons.HorizonsClass.html#astroquery.jplhorizons.HorizonsClass.vectors

Returns

: astropy.Table

The JPL Horizons vector query result.

pos : numpy.ndarray

The position vector in au or km, if return_arr is True.

vel : numpy.ndarray

The velocity vector in au/day or km/s, if return_arr is True.