cartesian_to_spherical

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

Convert a velocity in Cartesian coordinates to velocity components in spherical 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.

The components of the output velocity all have units of velocity, i.e., this is not used for transforming from a cartesian velocity to 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:

vsph : Quantity

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