healpix 2025.1


pip install healpix

  Latest version

Released: Jul 07, 2025

Project Links

Meta
Maintainer: Nicolas Tessore
Requires Python: >=3.9

Classifiers

Programming Language
  • Python :: 3

License
  • OSI Approved :: BSD License

Operating System
  • OS Independent

healpix

Python and C package for HEALPix discretisation of the sphere

This package implements a lean set of routines for working with the HEALPix discretisation of the sphere. It supports NSIDE parameters up to 2^29.

The C library is based on the healpix_bare library, which was released under the 3-clause BSD license, with the following additions:

  • Sub-pixel indexing.
  • Conversions between the UNIQ and RING/NEST pixel indexing schemes.

If you are using this code in your research, please consider citing the original paper in your publications:

Python

The Python package provides functions that deal with the discretisation of the sphere itself. It is not meant to be a replacement of healpy, and does not contain things such as functions for the visualisation of maps, or spherical harmonic transforms.

The Python package consists of two modules:

  • The low-level chealpix module, which is a native C extension, and efficiently vectorises the C library functions over arbitrary numpy array inputs (including scalars, of course).

  • The high-level healpix module, which contains a more streamlined interface, and additional functionality:

    • Random point picking in HEALPix pixels.

For a function reference, run pydoc healpix (or pydoc chealpix) locally if you have the package installed, or see the online reference.

The high-level functions in the healpix module can be used more or less interchangeably with functions from the healpy package. However, in some cases, compatibility is sacrificed for consistency.

The Python package requires only numpy, and can be installed using pip:

pip install healpix

The vectorised C functions carefully avoid the creation of temporary arrays, and therefore have minimal memory overhead:

>>> import numpy as np, healpix, tracemalloc
>>> 
>>> # random vectors with 1G of memory per component (less than a NSIDE=4K map)
>>> x, y, z = np.random.randn(3, 125_000_000)
>>> 
>>> tracemalloc.start()
>>> 
>>> lon, lat = healpix.vec2ang(x, y, z, lonlat=True)
>>> 
>>> tracemalloc.get_traced_memory()
(2000010342, 2000013889)  # current, peak
>>> 
>>> # no memory overhead: only the 2G output arrays were used

Wheel compatibility matrix

Platform CPython 3.9 CPython 3.10 CPython 3.11 CPython 3.12 CPython 3.13
macosx_10_13_x86_64
macosx_10_9_x86_64
macosx_11_0_arm64
manylinux1_x86_64
manylinux_2_28_x86_64
manylinux_2_5_x86_64
musllinux_1_2_x86_64
win32
win_amd64

Files in release

healpix-2025.1-cp310-cp310-macosx_10_9_x86_64.whl (22.6KiB)
healpix-2025.1-cp310-cp310-macosx_11_0_arm64.whl (21.9KiB)
healpix-2025.1-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (68.4KiB)
healpix-2025.1-cp310-cp310-musllinux_1_2_x86_64.whl (67.5KiB)
healpix-2025.1-cp310-cp310-win32.whl (24.1KiB)
healpix-2025.1-cp310-cp310-win_amd64.whl (25.2KiB)
healpix-2025.1-cp311-cp311-macosx_10_9_x86_64.whl (22.6KiB)
healpix-2025.1-cp311-cp311-macosx_11_0_arm64.whl (21.9KiB)
healpix-2025.1-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (69.3KiB)
healpix-2025.1-cp311-cp311-musllinux_1_2_x86_64.whl (68.5KiB)
healpix-2025.1-cp311-cp311-win32.whl (24.1KiB)
healpix-2025.1-cp311-cp311-win_amd64.whl (25.2KiB)
healpix-2025.1-cp312-cp312-macosx_10_13_x86_64.whl (22.7KiB)
healpix-2025.1-cp312-cp312-macosx_11_0_arm64.whl (21.9KiB)
healpix-2025.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (69.2KiB)
healpix-2025.1-cp312-cp312-musllinux_1_2_x86_64.whl (68.3KiB)
healpix-2025.1-cp312-cp312-win32.whl (24.2KiB)
healpix-2025.1-cp312-cp312-win_amd64.whl (25.3KiB)
healpix-2025.1-cp313-cp313-macosx_10_13_x86_64.whl (22.7KiB)
healpix-2025.1-cp313-cp313-macosx_11_0_arm64.whl (21.9KiB)
healpix-2025.1-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (69.2KiB)
healpix-2025.1-cp313-cp313-musllinux_1_2_x86_64.whl (68.3KiB)
healpix-2025.1-cp313-cp313-win32.whl (24.2KiB)
healpix-2025.1-cp313-cp313-win_amd64.whl (25.3KiB)
healpix-2025.1-cp39-cp39-macosx_10_9_x86_64.whl (22.6KiB)
healpix-2025.1-cp39-cp39-macosx_11_0_arm64.whl (21.9KiB)
healpix-2025.1-cp39-cp39-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (68.2KiB)
healpix-2025.1-cp39-cp39-musllinux_1_2_x86_64.whl (67.3KiB)
healpix-2025.1-cp39-cp39-win32.whl (24.1KiB)
healpix-2025.1-cp39-cp39-win_amd64.whl (25.2KiB)
healpix-2025.1.tar.gz (22.2KiB)
Extras:
Dependencies:
numpy