Skip to content

Maps, masks, and spectra

HEALPix resolution

NSIDE must be a positive power of two. A full map contains NPIX = 12 × NSIDE² pixels, so increasing NSIDE by two multiplies both the pixel count and the number of line-of-sight evaluations by four.

NSIDE Pixels Typical role
1 12 wiring test only
8 768 tutorial or smoke test
32 12,288 exploratory calculation
128 196,608 analysis candidate after convergence tests
512 3,145,728 high-cost production calculation

The roles are guidance, not accuracy guarantees. Required resolution depends on morphology, mask, and science objective.

Masks

A mask prevents excluded pixels from being calculated. Masked pixels are written as the HEALPix BAD_DATA sentinel (pyhermes.UNSEEN).

Galactic-plane window:

plane = hermes.RectangularWindow(
    [5.0 * units.deg, -5.0 * units.deg],
    [0.0 * units.deg, 360.0 * units.deg],
)
skymap.setMask(plane)

The latitude pair is the upper and lower boundary. Longitudes use [0°, 360°] and may wrap across zero, for example [355°, 5°].

Other choices are:

  • CircularWindow(centre, aperture) for a disc;
  • InvertMask(mask) for the complement;
  • MaskList() with addMask() for the intersection of allowed regions (a direction must be accepted by every member mask).

Energy ranges

GammaSkymapRange creates logarithmically spaced maps including both energy endpoints:

maps = hermes.GammaSkymapRange(
    8,
    1.0 * units.TeV,
    100.0 * units.TeV,
    9,
)
maps.setIntegrator(integrator)
maps.setMask(plane)
maps.compute()
maps.save(hermes.outputs.HEALPixFormat("spectrum.fits.gz"))

The output contains one binary-table extension per energy.

Region-averaged spectra

Average only finite, unmasked pixels. Never divide the sum of a partial-sky map by the full NPIX; that biases the result toward zero. The maintained FITS reader in hermes-examples checks BAD_DATA, NSIDE, ordering, coordinate system, energy, units, and pixel count before forming a mean.

See example 08_pi0_masked_spectrum.py in the example catalogue.