astropy-healpix provides HEALPix (Hierarchical Equal Area isolations of the Sphere) functionality, including coordinate transformations, pixelization, and query methods, tightly integrated with the Astropy ecosystem. It is currently at version 1.1.3 and maintains an active development status, with releases often coordinated with major Astropy versions or for bug fixes as needed.
pip install astropy-healpixVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize a `HEALPix` object, convert HEALPix pixel indices to sky coordinates, and convert sky coordinates back to pixel indices. It uses common Astropy coordinate and unit objects for integration.
Explicitly specify `order='ring'` in your `HEALPix` or `HpxGeom` constructor if you intend to use ring ordering (e.g., `HEALPix(nside=32, order='ring', frame=ICRS())`).
Always ensure your `astropy` installation meets the minimum version requirement specified by `astropy-healpix` (typically found in the `pyproject.toml` or `setup.cfg` on GitHub, or PyPI's `Requires-Dist` section).
Ensure the value passed to `nside` is always a power of 2. For example, `HEALPix(nside=64, ...)` is valid, but `HEALPix(nside=10, ...)` is not.
The correct import path for the `astropy-healpix` library is `from astropy_healpix import HEALPix` (note the underscore).
Change `nside` to a power of 2 (e.g., 2, 4, 8, 16, 32, 64, etc.). For instance, `HEALPix(nside=32, ...)` is valid, while `HEALPix(nside=50, ...)` is not.
Remove the `frame` argument when initializing `HpxGeom`. If you need to work with sky coordinates, use the `HEALPix` class instead.