First map¶
This small Python calculation creates a 10 GeV pion-decay gamma-ray map from DRAGON2 cosmic-ray protons, atomic-gas rings, and the Kamae et al. interaction model.
Save as first_map.py:
import pyhermes as hermes
units = hermes.units
nside = 8
energy = 10.0 * units.GeV
cosmic_rays = hermes.cosmicrays.Dragon2D(hermes.Proton)
gas = hermes.neutralgas.RingModel(hermes.neutralgas.GasType.HI)
cross_section = hermes.interactions.Kamae06Gamma()
integrator = hermes.PiZeroIntegrator(cosmic_rays, gas, cross_section)
integrator.setObsPosition(
hermes.Vector3QLength(8.0 * units.kpc, 0.0 * units.kpc, 0.0 * units.kpc)
)
integrator.setupCacheTable(20, 20, 8)
skymap = hermes.GammaSkymap(nside, energy)
skymap.setIntegrator(integrator)
skymap.compute()
skymap.save(hermes.outputs.HEALPixFormat("first-map.fits.gz"))
print("pixels:", len(skymap))
print("mean intensity:", float(skymap.getMean()))
print("units:", skymap.getOutputUnitsAsString())
Run it inside the HERMES environment:
At NSIDE=8, the map has 12 × NSIDE² = 768 RING-ordered HEALPix pixels.
The low resolution is suitable for learning and smoke checks, not a scientific
production result.
What each object does¶
Dragon2Dsupplies the position- and energy-dependent cosmic-ray density.RingModelsupplies the target gas distribution.Kamae06Gammasupplies the differential production cross section.PiZeroIntegratorcombines the ingredients along each line of sight.GammaSkymapselects the HEALPix resolution and secondary energy.HEALPixFormatwrites the product and scientific metadata to FITS.
The maintained examples add command-line controls, safe overwrite handling, plotting, masks, spectra, and metadata validation. Continue with Examples.