Skip to content

Cosmic rays

Cosmic-ray models implement getDensityPerEnergy(energy, position) and expose their sampled energy axis. They live under pyhermes.cosmicrays in Python.

Model Purpose Runtime data
Dragon2D axisymmetric DRAGON2 solutions for one or several particle IDs Yes
Dragon3D three-dimensional grid solution Yes
Sun08 analytic spatial/spectral model No
WMAP07 analytic electron model No
UHECR ultra-high-energy cosmic rays No
SimpleCR simple configurable/test distribution No
DummyCR controlled development/test model No

Example with protons and helium:

cosmic_rays = hermes.cosmicrays.Dragon2D(
    [hermes.Proton, hermes.Helium]
)

Do not silently replace a single-species calculation with the multi-species constructor. Cross-section models differ in their support for projectile and target nuclei.

Inspect a density

position = hermes.Vector3QLength(
    8.3 * units.kpc,
    0.0 * units.kpc,
    0.0 * units.kpc,
)
protons = hermes.cosmicrays.Dragon2D(hermes.Proton)
energy = protons.getEnergyAxis()[0]
density = protons.getDensityPerEnergy(energy, position)
print(float(energy), float(density))

Use 09_ingredient_plots.py to plot proton, helium, electron, and positron inputs with explicit units.