Working with resolutions

A Healpix tessellation is parametrized by a number, called NSIDE, which must be a positive power of 2. It is related to the number of pixels $N$ in the maps by the simple equation $N = 12 \mathrm{NSIDE}^2$, and it is therefore related to the resolution of the pixelization. Any function working on a Healpix tessellation needs to receive the value of NSIDE. Healpix.jl provides a wrapper around this parameter, the Resolution type, which internally keeps a number of precomputed coefficients to accelerate calculations.

The following example prints a table containing details about a few Healpix resolutions:

using Printf

@printf("%-6s\t%-12s\t%-12s\t%-12s\n",
        "NSIDE",
        "#pix",
        "#pix per face",
        "solid angle")
for poweroftwo in [0, 1, 2, 3, 4, 5]
    res = Resolution(2 ^ poweroftwo)
    @printf("%6d\t%12d\t%12d\t%12.4f\n",
            res.nside,
            res.numOfPixels,
            res.pixelsPerFace,
            4π / res.numOfPixels)
end
NSIDE 	#pix        	#pix per face	solid angle
     1	          12	           1	      1.0472
     2	          48	           4	      0.2618
     4	         192	          16	      0.0654
     8	         768	          64	      0.0164
    16	        3072	         256	      0.0041
    32	       12288	        1024	      0.0010

There is an upper limit to the value of the NSIDE parameter, which is encoded in the constant NSIDE_MAX. The value is determined at runtime according to the size of the Int type; on 32-bit machines it is 8192 ($2^{13}$), while on 64-bit machines it is 536870912 ($2^{29}$).

Healpix.ResolutionType
struct Resolution

Resolution objects are needed to perform a number of pixel-related functions, e.g., convert a direction into a pixel number and vice versa.

The fields of a Resolution object are the following:

  • nside: the NSIDE parameter
  • nsideTimesTwo: 2 * NSIDE
  • nsideTimesFour: 4 * NSIDE
  • numOfPixels: number of pixels in the map
  • order: order of the map
  • pixelsPerFace: number of pixels in each Healpix face
  • ncap
  • fact2
  • fact1
source
Healpix.nsideokMethod
nsideok(nside::Integer) -> Bool

Check whether nside is a valid NSIDE parameter.

source
Healpix.nside2npixMethod
nside2npix(nside::Integer) -> Integer

Return the number of pixels for a Healpix map with the specified NSIDE value. If NSIDE is not an integer power of two, the function throws a DomainError exception.

source
Healpix.npix2nsideMethod
npix2nside(npix::Integer) -> Integer

Given the number of pixels in a Healpix map, return the NSIDE resolution parameter. If the number is invalid, throw a DomainError exception.

source
Healpix.nside2pixareaMethod
nside2pixarea(nside::Integer) -> Real

Return the solid angle of a pixel in a map with the specified NSIDE parameter. The result is expressed in steradians.

source
Healpix.nside2resolMethod
nside2resol(nside::Integer) -> Real

Return the approximate resolution of a map with the specified NSIDE. The resolution is expressed in radians, and it is the square root of the pixel size.

source
Healpix.ORDER_MAXConstant
ORDER_MAX

Maximum order for the resolution of a map supported on this machine. The value of NSIDE_MAX is equal to 2^ORDER_MAX.

source