galpy.util.coords.XYZ_to_lbd

galpy.util.coords.XYZ_to_lbd(X, Y, Z, degree=False)[source]

Transform from rectangular Galactic coordinates to spherical Galactic coordinates (works with vector inputs)

Parameters:
  • X (float or numpy.ndarray) – Component towards the Galactic Center (in kpc; though this obviously does not matter))

  • Y (float or numpy.ndarray) – Component in the direction of Galactic rotation (in kpc)

  • Z (float or numpy.ndarray) – Component towards the North Galactic Pole (kpc)

  • degree (bool, optional) – If True, return l and b in degrees (default is False)

Returns:

[l,b,d] in (rad or degree,rad or degree,kpc); for vector inputs [:,3]

Return type:

tuple or numpy.ndarray

Notes

  • 2009-10-24 - Written - Bovy (NYU)

  • 2014-06-14 - Re-written w/ numpy functions for speed and w/ decorators for beauty - Bovy (IAS)