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.Resolution
— Typestruct 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 parameternsideTimesTwo
: 2 * NSIDEnsideTimesFour
: 4 * NSIDEnumOfPixels
: number of pixels in the maporder
: order of the mappixelsPerFace
: number of pixels in each Healpix facencap
fact2
fact1
Healpix.Resolution
— MethodResolution(nside) -> Resolution
Create a Resolution
object, given a value for NSIDE
.
Healpix.nsideok
— Methodnsideok(nside::Integer) -> Bool
Check whether nside
is a valid NSIDE
parameter.
Healpix.nside2npix
— Methodnside2npix(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
— Methodnpix2nside(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
— Methodnside2pixarea(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
— Methodnside2resol(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.
Healpix.nside2order
— Methodnside2order(nside::Integer)
Return the order (positive integer) associated with a given NSIDE. If the given nside is not valid, throw a DomainError
exception.
If you have created a Healpix.Resolution
object, you can access the order through the field order
.
See also order2nside
.
Healpix.order2nside
— Methodorder2nside(order::Integer)
Return the value of NSIDE for a given order. If the given order is not valid, throw a DomainError
exception.
If you have created a Healpix.Resolution
object, you can access the value of NSIDE through the field nside
.
See also nside2order
.
Healpix.ORDER_MAX
— ConstantORDER_MAX
Maximum order for the resolution of a map supported on this machine. The value of NSIDE_MAX
is equal to 2^ORDER_MAX
.
Healpix.NSIDE_MAX
— ConstantNSIDE_MAX
Maximum allowed value for the NSIDE resolution parameter.