galpy.util.coords.XYZ_to_galcencyl

galpy.util.coords.XYZ_to_galcencyl(X, Y, Z, Xsun=1.0, Zsun=0.0, _extra_rot=True)[source]

Transform XYZ coordinates (wrt Sun) to cylindrical Galactocentric coordinates

Parameters:
  • X (float or numpy.ndarray) – X coordinate.

  • Y (float or numpy.ndarray) – Y coordinate.

  • Z (float or numpy.ndarray) – Z coordinate.

  • Xsun (float or numpy.ndarray, optional) – Cylindrical distance to the GC (can be array of same length as R).

  • Zsun (float or numpy.ndarray, optional) – Sun’s height above the midplane (can be array of same length as R).

  • _extra_rot (bool, optional) – If True, perform an extra tiny rotation to align the Galactocentric coordinate frame with astropy’s definition.

Returns:

Containing (R,phi,z)

Return type:

numpy.ndarray

Notes

  • 2010-09-24 - Written - Bovy (NYU)

  • 2023-07-19 - Allowed Xsun/Zsun to be arrays - Bovy (UofT)