# Can you get motion data using astropy.coordinates.get_body()?

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')
print(mars.ra)
print(mars.dec)
print(mars.pm_dec)


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()?

"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)>

• 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.
– user44357
Apr 5, 2022 at 16:54
• 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
– user44357
Apr 5, 2022 at 16:58
• The rate of change of declination (or of RA) is a type of velocity. It's an angular velocity in spherical coordinates
– user44357
Apr 5, 2022 at 17:10
• 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. Apr 5, 2022 at 20:32