# healpy: equal area pixelization and spherical harmonics transforms for data on the sphere in Python

Andrea Zonca, Leo Singer, Daniel Lenz, Martin Reinecke, Cyrille Rosset, Eric

Hivon, Krzysztof Gorski

► To cite this version:

Andrea Zonca, Leo Singer, Daniel Lenz, Martin Reinecke, Cyrille Rosset, et al., healpy: equal area pixelization and spherical harmonics transforms for data on the sphere in Python. Journal of Open Source Software, 2019, 4 (35), pp.1298. 10.21105/joss.01298. insu-03747945

HAL Id: insu-03747945

https://insu.hal.science/insu-03747945

Submitted on 9 Aug 2022

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# healpy: equal area pixelization and spherical harmonics transforms for data on the sphere in Python

Andrea Zonca¹, Leo P Singer⁶, Daniel Lenz², Martin Reinecke³, Cyrille Rosset⁵, Eric Hivon⁴, and Krzysztof M Gorski²

1 San Diego Supercomputer Center, University of California, San Diego, USA 2 Jet Propulsion Laboratory, California Institute of Technology, Pasadena, California, USA 3 Max-Planck-Institute for Astrophysics, Garching, Germany 4 Institut d'Astrophysique de Paris, CNRS/Sorbonne Université, Paris, France 5 Laboratoire Astroparticules et Cosmologie, CNRS/Université Paris Diderot, Paris, France 6 Goddard Space Flight Center, NASA, Greenbelt, Maryland, USA

DOI: 10.21105/joss.01298

## Software

* Review ⚡

* Repository ⚡

* Archive ⚡

Submitted: 28 February 2019

Published: 27 March 2019

## License

Authors of papers retain copyright and release the work under a Creative Commons Attribution 4.0 International License (CC-BY).

## Summary

Recent experiments measuring the temperature and polarization of the Cosmic Microwave Background, like WMAP (Bennett et al., 2013) and Planck (Planck Collaboration, 2018), produce all-sky maps at higher and higher resolution. Handling those datasets efficiently and studying their statistical properties requires a discretization scheme on the sphere. The Hierarchical Equal Area isoLatitude Pixelization, HEALPix (Górski et al., 2005), scheme (see Fig. 1) has proven to be an excellent mathematical framework to store map-domain data and efficiently compute their Spherical Harmonics Transform, whose Angular Power Spectrum is one the most powerful tools to understand the early Universe.

The HEALPix team provides FORTRAN, C++, IDL/GDL and Java implementations of the framework with simulation, analysis and visualization functionalities, format definitions for FITS files, and extensive documentation of each routine and facility.

healpy is a wrapper to the multi-threaded HEALPix C++ library in Python, it implements a user-friendly interface for all HEALPix functionalities, most importantly a fast nearest-neighbor search and the decomposition into Spherical Harmonics coefficients. It also adds utilities to read/write maps, Spherical Harmonics coefficients, and Power Spectrum values as FITS files based on astropy.io.fits. Finally it provides extensive plotting functionality, i.e. Mollweide, Gnomonic and Cartographic projections based on Matplotlib. We also release a conda package on conda-forge and wheels on PyPI for Linux and MacOS. These packages also bundle the HEALPix C++ library. Moreover, healpy is distributed as part of the HEALPix release package; within the installation script, a single

<figure><img src="image_2.png" /><figcaption>**Figure 1:** See how a sphere is first split into 12 base pixels of equal area whose centers are aligned at three different latitudes. Then, each is further subdivided to achieve higher and higher resolution.</figcaption></figure>
C++ dynamic library is installed in the target system and used both by the C++ binaries and by **healpy**.

healpy was designed to be used by professional cosmologists and students to analyze outputs of Cosmic Microwave Background experiments. WMAP, Planck and many other experiment in the field release their maps in HEALPix FITS format that can be accessed, visualized, and analyzed with **healpy**. More recently, its usage spread to other branches of Astrophysics including galaxy surveys e.g. Sloan Digital Sky Survey depth maps, Gamma-ray astronomy e.g. Fermi (Deil & others, 2018), and gravitational waves measurements e.g. LIGO (Singer et al., 2016).

## How to cite

If a publication is based on work that used **healpy**, please add the acknowledgement statement: "Some of the results in this paper have been derived using the **healpy** and **HEALPix** packages" and cite this paper and the original **HEALPix** paper (Górski et al., 2005).

## Acknowledgements

We acknowledge the Planck collaboration and in particular Peter Meinhold, Julian Borrill and Charles Lawrence for supporting Andrea Zonca's work on the project. We thank all past and current contributors. For a full overview, see the latest list of contributors on Github.

## References

Bennett, C. L., Larson, D., Weiland, J. L., Jarosik, N., Hinshaw, G., Odegard, N., Smith, K. M., et al. (2013). Nine-year Wilkinson Microwave Anisotropy Probe (WMAP) Observations: Final Maps and Results, 208, 20. doi:10.1088/0067-0049/208/2/20

Deil, C., & others. (2018). Gammapy - A prototype for the CTA science tools. PoS, ICRC2017, 766. doi:10.22323/1.301.0766

Górski, K. M., Hivon, E., Banday, A. J., Wandelt, B. D., Hansen, F. K., Reinecke, M., & Bartelmann, M. (2005). HEALPix: A Framework for High-Resolution Discretization and Fast Analysis of Data Distributed on the Sphere, 622, 759-771. doi:10.1086/427976

Planck Collaboration. (2018). Planck 2018 results. I. Overview and the cosmological legacy of Planck.

Singer, L. P., Chen, H.-Y., Holz, D. E., Farr, W. M., Price, L. R., Raymond, V., Cenko, S. B., et al. (2016). SUPPLEMENT: "GOING THE DISTANCE: MAPPING HOST GALAXIES OF LIGO AND VIRGO SOURCES IN THREE DIMENSIONS USING LOCAL COSMOGRAPHY AND TARGETED FOLLOW-UP" (2016, ApJL, 829, l15). The Astrophysical Journal Supplement Series, 226(1), 10. doi:10.3847/0067-0049/226/1/10