cartesian_to_physicsspherical¶
-
gala.coordinates.
cartesian_to_physicsspherical
(pos, vel)[source]¶ Convert a velocity in Cartesian coordinates to velocity components in spherical coordinates. This follows the naming convention used in
astropy.coordinates
: physics spherical coordinates consist of a radius, \(r\), a longitude, \(\phi\), in the range [0, 360] deg and a colatitude, \(\theta\), in the range [0, 180] deg, measured from the z-axis.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{r}} + v_\phi\boldsymbol{\hat{\phi}} + v_\theta\boldsymbol{\hat{\theta}}\\\\ &= \dot{r}\boldsymbol{\hat{r}} + r\sin\theta \dot{\phi}\boldsymbol{\hat{\phi}} + r\dot{\theta}\boldsymbol{\hat{\theta}}\end{split}\]Parameters: pos :
Quantity
,BaseCoordinateFrame
,BaseRepresentation
Input position or positions as one of the allowed types. You may pass in a
Quantity
withdimensionless_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
withdimensionless_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.