I am trying to use get_body() to get position and motion data for solar system objects.

I’ve tried the following:

from astropy.time import Time
from astropy.coordinates import solar_system_ephemeris, get_body
t = Time('2019.5',format='jyear')
mars = get_body('Mars',t,ephemeris='de432s')

The first two print statements work fine. The last line throws this error:

TypeError: Frame data has no associated differentials (i.e. the frame has no velocity data) - represent_as() only accepts a new representation.

The same thing happens if I try any other solar system body as well.

Can I get motion data (such as the rate of change of the declination) using get_body()?


1 Answer 1


"Proper motion" is the name used for the motion in the sky of stars. It is not a velocity. It is not measured in metres per second, but in arcseconds per year. If a star was moving directly towards Earth, its proper motion would be zero. Proper motion is "proper" because it is not the apparent motion caused by parallax as the Earth moves around the sun.

So you can't talk about the proper motion of the Earth. The Earth is not a "heavenly body", when viewed from Earth. We don't talk about "proper motion" of planets either. For a planet, the parallax motion is much larger, and of course the motion of the planet is an orbit. Whereas the proper motion of stars is linear. The proper motion can be found in a database, the planetary motion has to be calculated.

If you want the velocity of a planet relative to it's orbital barycentre you have get_body_barycentric_posvel it returns a tuple of (position, velocity) as cartesian coordinates (x,y,z)

>>> m = get_body_barycentric_posvel('mars',t)
>>> m[1]
<CartesianRepresentation (x, y, z) in AU / d
    (-0.00981358, -0.00759165, -0.00321724)>
  • $\begingroup$ I don't know if you posted your response before I made an edit but I realized the contradiction and I changed Earth to Mars. The fact remains that the error occurs for ALL solar system bodies. $\endgroup$
    – user44357
    Apr 5, 2022 at 16:54
  • $\begingroup$ Based on what you said about proper motion of planets, does that mean I can't look up the rate of change of RA and dec, for a given moment in time, of a planet in a database? I am able to do so using JPL Horizons $\endgroup$
    – user44357
    Apr 5, 2022 at 16:58
  • $\begingroup$ The rate of change of declination (or of RA) is a type of velocity. It's an angular velocity in spherical coordinates $\endgroup$
    – user44357
    Apr 5, 2022 at 17:10
  • $\begingroup$ I hadn't seen your edit, Horizons does have rates of change of ra and dec. but it doesn't look them up in a database, they are calculated. Of course the values of ra and dec are also calculated for planets, so it could be done. Of course a cheap and cheerful approximation can be found using a linear or quadratic approximation to the curve. $\endgroup$
    – James K
    Apr 5, 2022 at 20:32

You must log in to answer this question.