radec_distance

giant.catalogues.utilities:

giant.catalogues.utilities.radec_distance(ra1, dec1, ra2, dec2)[source]

This function computes the great-circle angular distance in units of radians between ra/dec pairs.

The distance is computed using

\[\text{cos}^{-1}\left(\text{cos}(\delta_1)\text{cos}(\delta_2)\text{cos}(\alpha_1-\alpha_2) + \text{sin}(\delta_1)\text{sin}(\delta_2)\right)\]

where \(\delta_1\) is the first declination, \(\delta_2\) is the second declination, \(\alpha_1\) is the first right ascension, and \(\alpha_2\) is the second right ascension, all in radians.

This function is vectorized and uses broadcasting rules, therefore you can specify the inputs as mixtures of scalars and arrays, as long as they can all be broadcast to a common shape. The output will be either a scalar (if all scalars are input) or an array if any of the inputs are an array.

Parameters:
  • ra1 (Sequence | ndarray | Real) – The right ascension values for the first parts of the pairs with units of radians

  • dec1 (Sequence | ndarray | Real) – The declination values for the first parts of the pairs with units of radians

  • ra2 (Sequence | ndarray | Real) – The right ascension values for the second parts of the pairs with units of radians

  • dec2 (Sequence | ndarray | Real) – The declination values for the second parts of the pairs with units of radians

Returns:

The great circle angular distance between the points with units of radians

Return type:

Sequence | ndarray | Real