Skip to content

Commit

Permalink
add nest optional arg in get_healpix_centers
Browse files Browse the repository at this point in the history
  • Loading branch information
TristanCantatGaudin authored Dec 13, 2023
1 parent b51dfd4 commit 2950c2d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/gaiaunlimited/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,23 @@
__all__ = ["coord2healpix", "get_healpix_centers"]


def get_healpix_centers(order):
def get_healpix_centers(order,nest=False):
"""Get centers of HEALPix as astropy coordinates.
Args:
order (int): The order of the pixelisation
Optional args:
nest (boolean): ``False`` for RING healpix scheme, ``True`` for nested.
default is ``False``.
Returns:
astropy.coordinates.SkyCoord: coordinates of the centers.
"""
nside = hp.order2nside(order)
npix = hp.order2npix(order)
ipix = np.arange(npix)
ra, dec = hp.pix2ang(nside, ipix, lonlat=True)
ra, dec = hp.pix2ang(nside, ipix, lonlat=True, nest=nest)
return coord.SkyCoord(ra * u.deg, dec * u.deg)


Expand Down

0 comments on commit 2950c2d

Please sign in to comment.