get_body_barycentric_posvel

astropy.coordinates.get_body_barycentric_posvel(body, time, ephemeris=None)[source]

Calculate the barycentric position and velocity of a solar system body.

Parameters:
bodypython:str or python:list of python:tuple

The solar system body for which to calculate positions. Can also be a kernel specifier (list of 2-tuples) if the ephemeris is a JPL kernel.

timeTime

Time of observation.

ephemerispython:str, optional

Ephemeris to use. By default, use the one set with astropy.coordinates.solar_system_ephemeris.set

Returns:
position, velocitypython:tuple of CartesianRepresentation

Tuple of barycentric (ICRS) position and velocity.

See also

get_body_barycentric

to calculate position only. This is faster by about a factor two for JPL kernels, but has no speed advantage for the built-in ephemeris.

Notes

You can either give an explicit ephemeris or use a default, which is normally a built-in ephemeris that does not require ephemeris files. To change the default to be the JPL ephemeris:

>>> from astropy.coordinates import solar_system_ephemeris
>>> solar_system_ephemeris.set('jpl')  

Use of any JPL ephemeris requires the jplephem package (https://pypi.org/project/jplephem/). If needed, the ephemeris file will be downloaded (and cached).

One can check which bodies are covered by a given ephemeris using:

>>> solar_system_ephemeris.bodies
('earth', 'sun', 'moon', 'mercury', 'venus', 'earth-moon-barycenter', 'mars', 'jupiter', 'saturn', 'uranus', 'neptune')