spherical_to_cartesian

gala.coordinates.spherical_to_cartesian(pos, vel)[source]

Convert a velocity in Spherical coordinates to Cartesian coordinates. This follows the naming convention used in astropy.coordinates: spherical coordinates consist of a distance, \(d\), a longitude, \(\phi\), in the range [0, 360] deg, and a latitude, \(b\), in the range [-90, 90] deg.

All components of the input spherical velocity should have units of velocity, i.e., this is not used for transforming angular velocities, but rather the velocity vector components in Eq. 2 below.

\[\begin{split}\boldsymbol{v} &= v_x\boldsymbol{\hat{x}} + v_y\boldsymbol{\hat{y}} + v_z\boldsymbol{\hat{z}}\\\\ &= v_r\boldsymbol{\hat{d}} + v_\phi\boldsymbol{\hat{\phi}} + v_b\boldsymbol{\hat{b}}\\\\ &= \dot{d}\boldsymbol{\hat{d}} + d\cos b \dot{\phi}\boldsymbol{\hat{\phi}} + d\dot{b}\boldsymbol{\hat{b}}\end{split}\]
Parameters:

pos : Quantity, BaseCoordinateFrame, BaseRepresentation

Input position or positions as one of the allowed types. You may pass in a Quantity with dimensionless_unscaled units if you are working in natural units.

vel : Quantity

Input velocity or velocities as one of the allowed types. You may pass in a Quantity with dimensionless_unscaled units if you are working in natural units. axis=0 is assumed to be the dimensionality axis, e.g., vx,vy,vz = vel should work.

Returns:

vxyz : Quantity

Array of Cartesian velocity components. Will have the same shape as the input velocity.