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
Healpix.Resolution
— Type.Resolution
objects are needed to perform a number of pixel-related functions, e.g., convert a direction into a pixel number and vice versa.
Healpix.Resolution
— Method.Resolution(nside) -> Resolution
Create a Resolution
object, given a value for NSIDE
.
Healpix.nsideok
— Method.nsideok(nside::Integer) -> Bool
Check whether nside
is a valid NSIDE
parameter.
Healpix.nside2npix
— Method.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.
Healpix.npix2nside
— Method.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.
Healpix.nside2pixarea
— Method.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.
Healpix.nside2resol
— Method.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.