EAG logo

HEALPix PixTools.java

The package gov.fnal.eag.healpix contains four classes - PixTools.java , Region.java, service classes BitManipulation.java, and PixInfo.java

These classes in general are translation of the corresponding HEALPix FORTRAN90 programs to Java.

The translation is not straight forward, but included junit tests have validated the package.

The Package Overview.

The package creates sky pixelization to a specified resolution. The original FORTRAN version has natural limit imposed by HEALPix to the number of pixels Npix = 12 x N^2, where N the number of sides is an integer power of 2 and <= 8192 (Npix ~ 8.0E8)

The presented Java version overcomes this limitation boosting the resolution to about 0.2 arcsec (Npix ~ 1.3E13) which seems to be sufficient for modern experiments like SNAP

These tools permit creation of HEALPix maps as well as use of existing maps. There are tools to translate sky coordinates (Ra, Dec) to a pixel number, and to generate a list of neighboring pixels within some specified radius. More complicated queries are also supported.

The new class Region was added to the package. The class permits to define a rectangular area on the sphere providing standard ra,dec (Right ascension and Declination) limits of the area. Provided methods permits to pixelize the area with specified size of pixels.

Package API.

For API description see Java docs.

To download the self-installing jar file click here.

To install these jar files and the package documentation use command:

java -jar eag-HEALPix.jar

This will create in the installation directory two jar files (vecmath.jar, PixTools.jar) and the "doc" subdirectory.


Working with highest resolution is time consuming and can be prohibitive. There is an optimized version of this package giving significant improvement in some cases. This version was developed by Jan Kotek, and can be found here.

06/14/2005 Nikolay Kuropatkin.

12/19/2007 Nikolay Kuropatkin.

04/11/2008 Nikolay Kuropatkin.

07/09/2008 Nikolay Kuropatkin. Bug fixed in inRing method

02/09/2010 Nikolay Kuropatkin. Bug was found by Jan Kotek in Query-disc with search radius smaller than the pixel size. Fixed.

11 Jan 2012 Nikolay Kuropatkin. Make the BitManipulation a static class.

11 Jan 2012 modifications were proposed and implemented by Mark Taylor to make the package thread safe.

All methods are thread safe now. This class can be used as a singleton, the singleton instance being available from the getInstance method. For compatibility with previous versions however it is possible to construct new instances using the default constructor.

Unit tests showing various methods of using the class are provided.

28 Jul 2012 Nikolay Kuropatkin. To address some silly test of QuertyDisc method when two close points over the pole are missing each other in inclusive search the radius modification for inclusive search was changed. As the pixel shape is changing toward the pole from almost square to triangular the radius modifier should grow. In normal case close to equator the modifier is chosen to be half of the angular size of the pixel. Now the modifier is a function of the z component of unit vector pointing in the center of disc. The modifier value M=a+abs(z)*a, where a is half pixel size. In this case no changes in the QueryDisc behavior in the equatorial area is expected, while in the polar area one can expect increased number of pixels returned in the inclusive search. The maximum number of additional pixels can be estimated as 2*PI*(radius + M)/(2*a).