SphereCoords

class sonic.SphereCoords
Method Summary
static azZenToCart(az, zen, radi)

Converts azimuth and zenith points on a sphere of radius radi to 3D vectors in Cartesian coordinates.

Inputs:
  • az (1xn double): vector of azimuth values, or angles wrt +x axis, in radians

  • zen (1xn double): vector of zenith values, or angles wrt +z axis, in radians (must be between 0 and pi)

  • radi (1x1 double): radius of sphere, defaults to 1

Outputs:
  • cartVec (3xn double): corresponding 3D vector in Cartesian coords (x,y,z)

Last revised: 10/01/24 Last author: Tara Mina

static cartToAzZen(cartVec)

Converts 3D vectors in Cartesian coordinates to azimuth and zenith points on a sphere of radius radi.

Inputs:
  • cartVec (3xn double): corresponding 3D vector in Cartesian coords (x,y,z)

Outputs:
  • az (1xn double): vector of azimuth values, or angles wrt +x axis, in radians (between 0 and 2*pi)

  • zen (1xn double): vector of zenith values, or angles wrt +z axis, in radians (between 0 and pi)

  • radi (1x1 double): radius of sphere (positive)

Last revised: 10/01/24 Last author: Tara Mina

static cartToRaDec(v)

Converts vectors (v) in cartesian coordinates to spherical coordinates given by right ascension (RA) and declination (DEC), both in radians. Also returns the magnitude of each vector.

Inputs:
  • v (3xn double): Matrix of vectors, with the vectors making up the columns. The n-th unit vector corresponds to the n-th (RA, DEC) pair.

Outputs:
  • ra_RAD (nx1 double): Column vector of right ascension values, in radians.

  • dec_RAD (nx1 double): Column vector of declination values, in radians.

  • r (nx1 double): Magnitude of each vector.

Last revised: 03/04/24 Last author: Michael Krause

static raDecToCart(ra_RAD, dec_RAD, r)

Converts equally sized vectors of right ascension and declination (given in radians) to vectors. If no r argument is supplied, it will convert them to unit vectors.

Inputs:
  • ra_RAD (nx1 double): Column vector of right ascension values, in radians.

  • dec_RAD (nx1 double): Column vector of declination values, in radians.

  • r (nx1 double): OPTIONAL: Column vector of vector magnitude, defaults to unit magnitude if not specified.

Outputs:
  • v (3xn double): Matrix of resultant vectors, with the vectors making up the columns. The n-th vector corresponds to the n-th (RA, DEC) pair. If r is not specified, these are all unit vectors.

Last revised: 03/01/24 Last author: Michael Krause