xyz_to_healpix

astropy_healpix.xyz_to_healpix(x, y, z, nside, return_offsets=False, order='ring')[source]

Convert longitudes/latitudes to HEALPix indices

Parameters:
x, y, zfloat or ndarray

The Cartesian coordinate components

nsideint or ndarray

Number of pixels along the side of each of the 12 top-level HEALPix tiles

order{ ‘nested’ | ‘ring’ }

Order of HEALPix pixels

return_offsetsbool, optional

If True, the returned values are the HEALPix pixel indices as well as dx and dy, the fractional positions inside the pixels. If False (the default), only the HEALPix pixel indices is returned.

Returns:
healpix_indexint or ndarray

The HEALPix indices

dx, dyndarray

Offsets inside the HEALPix pixel in the range [0:1], where 0.5 is the center of the HEALPix pixels