Skip to main content

Python package for HEALPix discretisation of the sphere

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

healpix-2024.1.tar.gz (18.1 kB view hashes)

Uploaded Source

Built Distributions

healpix-2024.1-cp312-cp312-win_amd64.whl (25.4 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

healpix-2024.1-cp312-cp312-win32.whl (24.0 kB view hashes)

Uploaded CPython 3.12 Windows x86

healpix-2024.1-cp312-cp312-musllinux_1_1_x86_64.whl (77.6 kB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ x86-64

healpix-2024.1-cp312-cp312-musllinux_1_1_i686.whl (79.5 kB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ i686

healpix-2024.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (75.4 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

healpix-2024.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (78.9 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

healpix-2024.1-cp312-cp312-macosx_11_0_arm64.whl (21.9 kB view hashes)

Uploaded CPython 3.12 macOS 11.0+ ARM64

healpix-2024.1-cp312-cp312-macosx_10_9_x86_64.whl (23.5 kB view hashes)

Uploaded CPython 3.12 macOS 10.9+ x86-64

healpix-2024.1-cp311-cp311-win_amd64.whl (25.3 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

healpix-2024.1-cp311-cp311-win32.whl (23.9 kB view hashes)

Uploaded CPython 3.11 Windows x86

healpix-2024.1-cp311-cp311-musllinux_1_1_x86_64.whl (77.8 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

healpix-2024.1-cp311-cp311-musllinux_1_1_i686.whl (79.7 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ i686

healpix-2024.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (75.5 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

healpix-2024.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (78.9 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

healpix-2024.1-cp311-cp311-macosx_11_0_arm64.whl (21.8 kB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

healpix-2024.1-cp311-cp311-macosx_10_9_x86_64.whl (23.3 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

healpix-2024.1-cp310-cp310-win_amd64.whl (25.3 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

healpix-2024.1-cp310-cp310-win32.whl (23.9 kB view hashes)

Uploaded CPython 3.10 Windows x86

healpix-2024.1-cp310-cp310-musllinux_1_1_x86_64.whl (76.8 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

healpix-2024.1-cp310-cp310-musllinux_1_1_i686.whl (78.6 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ i686

healpix-2024.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (74.4 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

healpix-2024.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (77.9 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

healpix-2024.1-cp310-cp310-macosx_11_0_arm64.whl (21.7 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

healpix-2024.1-cp310-cp310-macosx_10_9_x86_64.whl (23.3 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

healpix-2024.1-cp39-cp39-win_amd64.whl (25.3 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

healpix-2024.1-cp39-cp39-win32.whl (23.9 kB view hashes)

Uploaded CPython 3.9 Windows x86

healpix-2024.1-cp39-cp39-musllinux_1_1_x86_64.whl (76.5 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

healpix-2024.1-cp39-cp39-musllinux_1_1_i686.whl (78.4 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ i686

healpix-2024.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (74.1 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

healpix-2024.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (77.6 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

healpix-2024.1-cp39-cp39-macosx_11_0_arm64.whl (21.7 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

healpix-2024.1-cp39-cp39-macosx_10_9_x86_64.whl (23.3 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

healpix-2024.1-cp38-cp38-win_amd64.whl (25.3 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

healpix-2024.1-cp38-cp38-win32.whl (23.9 kB view hashes)

Uploaded CPython 3.8 Windows x86

healpix-2024.1-cp38-cp38-musllinux_1_1_x86_64.whl (77.4 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

healpix-2024.1-cp38-cp38-musllinux_1_1_i686.whl (79.2 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ i686

healpix-2024.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (74.7 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

healpix-2024.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (78.1 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

healpix-2024.1-cp38-cp38-macosx_11_0_arm64.whl (21.7 kB view hashes)

Uploaded CPython 3.8 macOS 11.0+ ARM64

healpix-2024.1-cp38-cp38-macosx_10_9_x86_64.whl (23.3 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

healpix-2024.1-cp37-cp37m-win_amd64.whl (25.3 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

healpix-2024.1-cp37-cp37m-win32.whl (23.8 kB view hashes)

Uploaded CPython 3.7m Windows x86

healpix-2024.1-cp37-cp37m-musllinux_1_1_x86_64.whl (76.9 kB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.1+ x86-64

healpix-2024.1-cp37-cp37m-musllinux_1_1_i686.whl (78.9 kB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.1+ i686

healpix-2024.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (74.4 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

healpix-2024.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (77.9 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

healpix-2024.1-cp37-cp37m-macosx_10_9_x86_64.whl (23.3 kB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page