coordinate_utility

spherical_2_cartesian(r, phi, theta[, units='degree'])

Converts spherical polar coordinates into cartesian coordinates.

Parameters
  • r (array) – Radial distance.

  • phi (array) – Longitudinal coordinates.

  • theta (array) – Latitude coordinates.

  • units (str) – Units of phi and theta given in either ‘degrees’ or ‘radians’.

Returns

x, y, z (array) : cartesian coordinates.

celestial_2_cartesian(r, ra, dec[, units='degree', output='both'])

Converts celestial spherical polar coordinates into cartesian coordinates.

Parameters
  • r (array) – Radial distance.

  • ra (array) – Longitudinal celestial coordinates.

  • dec (array) – Latitudinal celestial coordinates.

  • units (str) – Units of ra and dec given in either ‘degrees’ or ‘radians’.

  • output (str) – ‘euclidean’ or ‘both’. Determines whether to output only the euclidean or both euclidean and spherical coordinates.

Returns

Returns tuple of either:

  • phi, theta (array) – spherical polar coordinates.

  • x, y, z (array) – cartesian coordinates.

spherical_2_unit_sphere(phi, theta[, units='degrees'])

Project coordinates across a sphere (or on the sky) into cartesian coordinates on a unit sphere.

Parameters
  • r (array) – Radial distance.

  • phi (array) – Longitudinal coordinates.

  • theta (array) – Latitudinal coordinates.

  • units (str) – Units of ra and dec given in either ‘degrees’ or ‘radians’.

Returns

x, y, z (array) : cartesian coordinates.

celestial_2_unit_sphere(ra, dec[, units='degrees', output='both'])

Project celestial coordinates on a sphere into cartesian coordinates on a unit sphere.

Parameters
  • r (array) – Radial distance.

  • ra (array) – Longitudinal celestial coordinates.

  • dec (array) – Latitudinal celestial coordinates.

  • units (str) – Units of ra and dec given in either ‘degrees’ or ‘radians’.

  • output (str) – ‘euclidean’ or ‘both’. Determines whether to output only the euclidean or both euclidean and spherical coordinates.

Returns

Returns tuple of either:

  • phi, theta (array) – spherical polar coordinates.

  • x, y, z (array) – cartesian coordinates.

perpendicular_distance_2_angle(distance)

Converts distances across a unit sphere to angular distances.

Parameters

distance (array) – Perpendicular distances across (i.e. going on the surface) a unit sphere.

Returns

angular_distance (array) – The angular distance between points across a unit sphere.