xyz_to_equatorial

ssapy.utils.xyz_to_equatorial(xq, yq, zq, xe=0, ye=0, ze=0, degrees=False)[source][source]

Convert rectangular coordinates (X, Y, Z) to equatorial right ascension (RA) and declination (DEC).

This function computes the equatorial coordinates of an object relative to the Earth or another reference point, given its rectangular coordinates in the equatorial coordinate system.

Parameters:

xq (float): X-coordinate of the object in the equatorial coordinate system. yq (float): Y-coordinate of the object in the equatorial coordinate system. zq (float): Z-coordinate of the object in the equatorial coordinate system. xe (float, optional): X-coordinate of the reference point (default is 0, typically Earth’s position). ye (float, optional): Y-coordinate of the reference point (default is 0, typically Earth’s position). ze (float, optional): Z-coordinate of the reference point (default is 0, typically Earth’s position). degrees (bool, optional): If True, returns the RA and DEC in degrees; otherwise, returns them in radians (default is False).

Returns:

tuple: A tuple containing:
  • ra (float): Right ascension of the object (in radians or degrees).

  • dec (float): Declination of the object (in radians or degrees).

Notes:

  • The calculation assumes the XY plane corresponds to the celestial equator, and the -X axis points toward the vernal equinox.

  • The rad0to2pi function ensures the RA is normalized to the range [0, 2π] in radians.

  • The np.arctan2 function is used to compute the RA, and np.arcsin is used for DEC.

  • If degrees=True, the results are converted from radians to degrees using np.degrees.

Example:

xyz_to_equatorial(1.0, 0.5, 0.3, xe=0.1, ye=0.2, ze=0.3, degrees=True) -> (ra, dec)