cart2pol#
- movement.utils.vector.cart2pol(data)[source]#
Transform Cartesian coordinates to polar.
- Parameters:
data (xarray.DataArray) – The input data containing
spaceas a dimension, withxandyin the dimension coordinate.- Returns:
An xarray DataArray containing the polar coordinates stored in the
space_poldimension, withrhoandphiin the dimension coordinate. The anglesphireturned are in radians, in the range[-pi, pi].- Return type:
Notes
To compute the angle
phiwe rely on thenumpy.arctan2function, which follows the C standard [1]. The C standard considers the case in which the inputs to thearctan2[2] function are signed zeros [3]. For simplicity and interpretability, inmovementwe only consider the case of unsigned (positive) zeros. We implement it by setting the anglephito 0 when the normrhoof the vector is 0.References
See also