unit_to_radec

giant.catalogues.utilities:

giant.catalogues.utilities.unit_to_radec(unit)[source]

This function converts a unit vector(s) into a right ascension/declination bearing(s).

The right ascension is defined as the angle between the x axis and the projection of the unit vector onto the xy-plane and is output between 0 and pi. The declination is defined as the angle between the xy-plane and the unit vector and is output between -pi/2 and pi/2 (positive values indicate the vector has a positive z component and negative values indicate the vector has a negative z component. These are computed using

\[\begin{split}dec = \text{sin}^{-1}(z) \\ ra = \text{tan}^{-1}\left(\frac{y}{x}\right)\end{split}\]

Note that the vector input should be along the first axis (or as columns if there are multiple vectors), and that the vector(s) needs to be of unit length or the results from this function will be invalid.

If the input contains more than 1 vector, then the output will be 2 arrays. Otherwise, if it is a single vector, the output will be 2 floats as a tuple.

Parameters:

unit (Sequence | ndarray) – The unit vector to be converted to a ra/dec bearing

Returns:

The right ascension(s) and declination(s) as a tuple in units of radians

Return type:

Tuple[Sequence | ndarray | Real, Sequence | ndarray | Real]