Converting space velocity vector components UVW to proper motion and radial velocity

Hi,
I would like to convert space velocity vector components (UVW) to proper motion and radial velocity, given the RA, Dec and distance of the source. Can this be done with any of the astropy modules?

thanks

1 Like

Yes, you can do this, e.g., as

from astropy.coordinates import (CartesianRepresentation,
                                 CartesianDifferential,
                                 Galactic)
co= Galactic(u=103*u.pc, v=-11*u.pc, w=93.*u.pc,
         U=31*u.km/u.s, V=-10*u.km/u.s, W=75*u.km/u.s,
         representation_type=CartesianRepresentation,
         differential_type=CartesianDifferential)
print(co.proper_motion,co.radial_velocity)

I don’t think you can initialize the Galactic object with RA, Dec, and distance, but you could first convert those to (u,v,w) as

from astropy.coordinates import SkyCoord
sco= SkyCoord(ra=10.*u.deg,dec=20.*u.deg,distance=10.*u.pc)
gco= sco.transform_to(Galactic())
gco= gco.represent_as(CartesianRepresentation)
print(gco.x,gco.y,gco.z)

This (x,y,z) = (u,v,w) that goes into Galactic.

Note that you can do exactly what you want to do in one go using a galpy Orbit instance as

from galpy.orbit import Orbit
o= Orbit([10.,20.,0.01,31,-10,75],radec=True,uvw=True)
print(o.pmll,o.pmbb,o.vlos)

Inputs in the second line are (ra in deg, dec in deg, distance in kpc, U/V/W in km/s). See the galpy docs.