Healpix library written in Julia
24 Stars
Updated Last
1 Year Ago
Started In
December 2014


Stable Dev Build Status Codecov

A set of Julia functions that implement the Healpix spherical projection.

The purpose of this package is to implement a Julia-only library, instead of providing bindings to the original implementation of the C/C++/Fortran Healpix library. This should make the package easier to port to those architecture which are not supported by the original implementation (e.g., Windows).

Of course, this mean that implementing new features is generally not trivial, as one has to re-implement the algorithm instead of just figuring out how to bind some C/C++/Fortran function.


From the Julia REPL, run

import Pkg

Usage examples

Here are some code snippets that show how to use Healpix.jl. It is interesting to have a look at test/runtests.jl as well.

Refer to the documentation for more examples.

Dealing with resolutions

The resolution of a Healpix map is uniquely determined by the NSIDE parameter. Healpix.jl precalculates a number of values from NSIDE to save time during computations; such values are saved in a Healpix.Resolution object:

import Healpix
res = Healpix.Resolution(256)
print("The pixel index is $(Healpix.ang2pixNest(res, 0.1, 0.2))\n")

Reading a map from a FITS file

This snippet loads a map named planck_70GHz.fits into an array of 64-bit floating-point numbers:

import Healpix

m = Healpix.readMapFromFITS("planck_70GHz.fits", 1, Float64)
print("average: $(mean(m.pixels))\n")


Healpix.jl is released under the GPL license. Versions before 2.3.0 were released under a MIT license, but this was considered incompatible with the way the code has been written (#15).