coords

Coordinate transformations.

skysegmentor.cart2sphere(x, y, z, center=[0.0, 0.0, 0.0])[source]

Return polar coordinates for a given set of cartesian coordinates.

Parameters:
  • x (array) – x coordinate.

  • y (array) – y coordinate.

  • z (array) – z coordinate.

  • center (list) – Center point of polar coordinate grid.

Returns:

  • r (array) – Radial coordinates.

  • phi (array) – Phi coordinates [0, 2pi].

  • theta (array) – Theta coordinates [0, pi].

skysegmentor.sphere2cart(r, phi, theta, center=[0.0, 0.0, 0.0])[source]

Converts spherical polar coordinates into cartesian coordinates.

Parameters:
  • r (array) – Radial distance.

  • phi (array) – Longitudinal coordinates (radians = [0, 2pi]).

  • theta (array) – Latitude coordinates (radians = [0, pi]).

  • center (list) – Center point of spherical polar coordinate grid.

Returns:

x, y, z – Euclidean coordinates.

Return type:

array

skysegmentor.distusphere(phi1, theta1, phi2, theta2)[source]

Compute angular (great-arc) distance between two points on a unit sphere.

Parameters:
  • phi1 (float or array) – Location of first points on the unit sphere.

  • theta1 (float or array) – Location of first points on the unit sphere.

  • phi2 (float or array) – Location of second points on the unit sphere.

  • theta2 (float or array) – Location of second points on the unit sphere.

Returns:

dist – Angular great-arc distance.

Return type:

float or array