horizons

This module contains an interface to JPL Horizons for retrieving ephemeris data of natural and artificial Solar System bodies. In Tudat, these data are most often used to define ephemeris settings through jpl_horizons_from_query() or jpl_horizons(). jpl_horizons_from_query() is equivalent to jpl_horizons(), but allows the HorizonsQuery to be inspected or modified before conversion to ephemeris settings. The interface is based on the astroquery [57] Python package.

The HorizonsQuery class can also be used directly to query Horizons and inspect the returned vectors. The HorizonsBatch class is a convenience wrapper for applying the same query settings to multiple bodies.

Classes

HorizonsQuery(query_id, location[, ...])

This class provides an interface to JPL's Horizon System.

HorizonsBatch(query_id_list, location[, ...])

Query object for retrieving Horizons data for multiple bodies.

class HorizonsQuery(query_id: str, location: str, query_type: str = 'default', epoch_start: datetime.datetime | float | None = None, epoch_end: datetime.datetime | float | None = None, epoch_step: str | None = None, epoch_list: list | None = None, extended_query: bool = False)[source]

Bases: object

This class provides an interface to JPL’s Horizon System. JPL Horizons provides access to ephemerides for many solar system objects, including asteroids, comets, planets, moons and select spacecraft. The class extends astroquery’s to cater to the needs of Tudat users, while maintaining compatibility with all of astroquery’s features.

There are some notable differences:

Time input has been simplified to reduce ambiguities:

  • List of times are given in seconds since J2000 TDB.

  • Start can be given in datetime format or seconds since J2000 TDB.

And some additional features:

  • Extended query allows data retrieval limits to be broken by automatically splitting up a query into multiple subqueries and combining the data.

  • Horizons vector queries can be converted to ephemeris settings with jpl_horizons_from_query().

cartesian(frame_orientation: str = 'ECLIPJ2000', aberations: str = 'geometric') → numpy.ndarray[source]

Retrieve the cartesian state using the Horizons Vector API.

Parameters:
Returns:

returns an n by 7 array with the time in seconds since J2000 TDB, and the cartesian position and velocities.

Return type:

np.ndarray

cartesian_uncertainties(frame_orientation: str = 'ECLIPJ2000', aberations: str = 'geometric', uncertainty_frame: str = 'xyz') → numpy.ndarray[source]

Retrieve the formal 1-sigma uncertainties of the cartesian state using the Horizons Vector API (VEC_TABLE parameter).

Horizons provides these uncertainties for numerically integrated small bodies (asteroids and comets) only. For other bodies, the uncertainties are NaN. Requires astroquery version 0.4.12 or higher.

See the Horizons API documentation for more info:

https://ssd-api.jpl.nasa.gov/doc/horizons.html#vec_table

Parameters:
  • frame_orientation (str, optional) – Reference Frame Orientation, see the .cartesian() method, by default “ECLIPJ2000”.

  • aberations (str, optional) – Aberations to be accounted for, see the .cartesian() method, by default “geometric”.

  • uncertainty_frame (str, optional) – Frame in which the uncertainties are given. Options are ‘xyz’ (axes of frame_orientation), ‘acn’ (along-track, cross-track, normal) and ‘rtn’ (radial, transverse, normal), by default “xyz”.

Returns:

returns an n by 7 array with the time in seconds since J2000 TDB, and the 1-sigma uncertainties of the three position components (in m) and the three velocity components (in m/s).

Return type:

np.ndarray

ephemerides(reference_system: str = 'J2000', extra_precision: bool = False, *args, **kwargs) → astropy.table.table.Table[source]

Implements the JPL Horizons ephemerides API and returns it in a raw Astropy table format.

This method queries the JPL Horizons system for ephemeris data, which includes time-interpolated observer parameters like Right Ascension and Declination. Note that these values are not real observations but are generated from the Horizons ephemeris model.

A number of quantities can be retrieved; their definitions can be found in the Horizons System Manual. By default, all available quantities are retrieved.

Additional parameters can be passed directly to the underlying astroquery call as keyword arguments (e.g., refraction=True). For a full overview, see the astroquery documentation.

Parameters:
  • reference_system (str, optional) – Coordinate reference system. Must be one of ‘ICRF’/’J2000’ or ‘B1950’. Defaults to “J2000”.

  • extra_precision (bool, optional) – Enables extra precision in Right Ascension and Declination values. Defaults to False.

Returns:

An Astropy table containing the processed output from Horizons, with added columns for UTC and TDB time scales in seconds since J2000.

Return type:

astropy.table.Table

Raises:

ValueError – If an unsupported reference_system is chosen.

interpolated_observations(degrees: bool = False, reference_system: str = 'J2000', extra_precision: bool = True, *args, **kwargs) → numpy.ndarray[source]

Retrieves interpolated Right Ascension and Declination from the Horizons ephemerides API. Note that these values are not real observations but instead interpolated values based on the Horizons ephemeris system.

Parameters:
  • degrees (bool, optional) – If True, return angular values in degrees; otherwise, in radians. Defaults to False.

  • reference_system (str, optional) – Coordinate reference system, value must be one of ICRF/J2000 or B1950. Defaults to “J2000”.

  • extra_precision (bool, optional) – Enables extra precision in Right Ascension and Declination values. Defaults to True.

Returns:

Numpy array (N, 3) with time in seconds since J2000 TDB, Right Ascension, and Declination.

Return type:

np.ndarray

interpolated_station_angles(degrees: bool = False, reference_system: str = 'J2000', extra_precision: bool = True, *args, **kwargs) → numpy.ndarray[source]

Retrieves interpolated Right Ascension and Declination from the Horizons ephemerides API. Note that these values are not real observations but instead interpolated values based on the Horizons ephemeris system.

Parameters:
  • degrees (bool, optional) – return values in degrees if True, radians if False, by default false

  • reference_system (str, optional) – Coordinate reference system, value must be one of ICRF/J2000 or B1950, by default “J2000”

  • extra_precision (bool, optional) – Enables extra precision in Right Ascension and Declination values, by default False

Returns:

Numpy array (N, 3) with time in seconds since J2000 TDB and the Right Ascension and Declination.

Return type:

np.ndarray

Raises:

ValueError – If time query has incorrect format or an incorrect reference system is chosen

vectors(frame_orientation: str = 'ECLIPJ2000', aberations: str = 'geometric', vector_table: str | None = None) → astropy.table.table.Table[source]

Retrieve Horizons Vectors api data in raw astropy format. For general purposes, use the .cartesian() method instead.

Parameters:
  • frame_orientation (str, optional) –

    Reference Frame Orientation, equivalent to the astroquery refplane parameter. Options are ‘J2000’/’earth’, ‘ECLIPJ2000’/’ecliptic’ and ‘body’ , by default “ECLIPJ2000”. See astroquery documentation for information about the ‘body’ option:

    https://astroquery.readthedocs.io/en/latest/jplhorizons/jplhorizons.html

  • aberations (str, optional) –

    Aberations to be accounted for. Options are: ‘geometric’, ‘astrometric’ and ‘apparent’, by default “geometric”.

    See the Horizons System Manual for more info:

    https://ssd.jpl.nasa.gov/horizons/manual.html#output

  • vector_table (str | None, optional) –

    Horizons VEC_TABLE parameter, selecting the quantities to be retrieved (e.g. ‘2x’ for the state and its 1-sigma uncertainties). If None, the Horizons default is used, by default None. Values other than None require astroquery version 0.4.12 or higher.

    See the Horizons API documentation for more info:

    https://ssd-api.jpl.nasa.gov/doc/horizons.html#vec_table

Returns:

Unprocessed vectors API data in astropy Table format.

Return type:

astropy.table.Table

property MPC_number: str | None

read-only

Retrieve the MPC (Minor Planet Centre) number of the object. The MPC number is inferred from data retrieved and will return none if data has not been retrieved yet. The MPC number is only relevant to minor planets such as asteroids, TNOs and Near-Earth Asteroids.

Type:

Union[str, None]

property designation: str | None

read-only

Retrieve the relevant designation of the query’s object. The designation is inferred from the data retrieved and will return none if data has not been retrieved yet. Minor planets and Comets will return their provisional designation (1898 DQ for Eros, 1982 HG1 for Halley). A comets’ formal designation can often be retrieved using the name property Spacecraft and Major Planets/ Moons will return their JPL number (-28 for JUICE, 6 for Saturn Barycentre).

Type:

Union[str, None]

property name: str | None

read-only

Retrieve the name of the query’s object. The name is inferred from the data retrieved and will return none if data has not been retrieved yet. Unnamed minor planets will use their designation instead. If a name can not be inferred, the raw name from Horizons will be returned. Please consider raising an issue on the Tudat github in such cases.

Type:

Union[str, None]

class HorizonsBatch(query_id_list: list[str], location: str, epoch_list: list | None = None, epoch_start: datetime.datetime | float | None = None, epoch_end: datetime.datetime | float | None = None, epoch_step: str | None = None, extended_query: bool = False)[source]

Bases: object

Query object for retrieving Horizons data for multiple bodies.

property names: None | List[str]

read-only

Retrieves a list of names of the query objects. Returns None if add_batch_ephemerides has not been run yet.

Type:

Union[None, List[str]]