ContinuumPrimaryFlux#

class gammapy.astro.darkmatter.ContinuumPrimaryFlux[source]#

Bases: TemplateNDSpectralModel

Continuum gamma-ray spectrum from dark matter annihilation.

Based on the precomputed tables of PPPC4 DM ID and CosmiXs. All available annihilation channels can be found in those tables. For a requested dark matter mass and channel, this class builds a TemplateNDSpectralModel over a 2D grid of (Log[10,x], mDM), enabling interpolation in dark matter mass while keeping mDM itself frozen as a model parameter.

Parameters:
mDMQuantity

Dark matter particle mass as rest mass energy. Must lie within the mass range tabulated by the chosen source.

channelstr

Annihilation channel, e.g. "b" for bb̄. See allowed_channels for the full list of supported channel labels. Availability of a given channel may depend on source.

sourcestr, optional

Data source for the spectral tables. Options are:

  • "pppc4" (default): Cirelli et al. (2011, 2016) PPPC4DMID tables.

  • "cosmixs": Cirelli et al. (2024) / CosmiXs tables.

  • A path to a custom file readable by astropy.table.Table.read (extensions .dat, .txt, .csv, or .ecsv).

If a custom file path is provided, it must contain "mDM" and "Log[10,x]" columns (after applying mapping_dict if given), plus columns named after the requested annihilation channel(s) using the internal channel registry naming convention.

mapping_dictdict, optional

Mapping dictionary used to rename the columns of a custom source file to the expected internal column names. Only used when source is a custom file path. Format is {actual_column_name: expected_column_name}, and must cover the mandatory columns "mDM" and "Log[10,x]".

Notes

Internally, the spectral table is read and reshaped into a 2D RegionGeom over (Log[10,x], mDM) axes, wrapped in a Map, and passed to the TemplateNDSpectralModel constructor with linear interpolation and zero-valued extrapolation. The mass parameter inherited from TemplateNDSpectralModel is frozen after initialization, since mDM is treated as a fixed configuration value rather than a fit parameter.

References

Attributes Summary

allowed_channels

List of allowed annihilation channels.

channel

Annihilation channel as a string.

channel_registry

default_parameters

mDM

Dark matter mass.

mandatory_keys

mapping_dict

Mapping dictionary for the spectra file.

mapping_dict_PPPC4_to_CosmiXs

source

Data source for the spectra.

tag

Methods Summary

evaluate(energy, *args)

Evaluate the continuum primary flux spectrum dN/dE.

from_dict(data)

Construct a ContinuumPrimaryFlux from a dictionary.

to_dict([full_output])

Serialize the model to a dictionary.

Attributes Documentation

allowed_channels#

List of allowed annihilation channels.

channel#

Annihilation channel as a string.

channel_registry = {'HZ': 'HZ', 'V->e': 'V->e', 'V->mu': 'V->\\[Mu]', 'V->tau': 'V->\\[Tau]', 'W': 'W', 'WL': 'WL', 'WT': 'WT', 'Z': 'Z', 'ZL': 'ZL', 'ZT': 'ZT', 'aZ': 'aZ', 'b': 'b', 'c': 'c', 'd': 'd', 'e': 'e', 'eL': 'eL', 'eR': 'eR', 'g': 'g', 'gamma': '\\[Gamma]', 'h': 'h', 'mu': '\\[Mu]', 'muL': '\\[Mu]L', 'muR': '\\[Mu]R', 'nu_e': '\\[Nu]e', 'nu_mu': '\\[Nu]\\[Mu]', 'nu_tau': '\\[Nu]\\[Tau]', 'q': 'q', 's': 's', 't': 't', 'tau': '\\[Tau]', 'tauL': '\\[Tau]L', 'tauR': '\\[Tau]R', 'u': 'u'}#
default_parameters = <gammapy.modeling.parameter.Parameters object>#
mDM#

Dark matter mass.

mandatory_keys = ['mDM', 'Log[10,x]']#
mapping_dict#

Mapping dictionary for the spectra file.

mapping_dict_PPPC4_to_CosmiXs = {'DM': 'mDM', 'Log10[x]': 'Log[10,x]', 'dNdLog10x[HZ]': None, 'dNdLog10x[H]': 'h', 'dNdLog10x[WL]': 'WL', 'dNdLog10x[WT]': 'WT', 'dNdLog10x[W]': 'W', 'dNdLog10x[ZL]': 'ZL', 'dNdLog10x[ZT]': 'ZT', 'dNdLog10x[Z]': 'Z', 'dNdLog10x[aZ]': None, 'dNdLog10x[a]': '\\[Gamma]', 'dNdLog10x[b]': 'b', 'dNdLog10x[c]': 'c', 'dNdLog10x[d]': 'd', 'dNdLog10x[eL]': 'eL', 'dNdLog10x[eR]': 'eR', 'dNdLog10x[e]': 'e', 'dNdLog10x[g]': 'g', 'dNdLog10x[muL]': '\\[Mu]L', 'dNdLog10x[muR]': '\\[Mu]R', 'dNdLog10x[mu]': '\\[Mu]', 'dNdLog10x[nue]': '\\[Nu]e', 'dNdLog10x[numu]': '\\[Nu]\\[Mu]', 'dNdLog10x[nutau]': '\\[Nu]\\[Tau]', 'dNdLog10x[s]': 's', 'dNdLog10x[t]': 't', 'dNdLog10x[tauL]': '\\[Tau]L', 'dNdLog10x[tauR]': '\\[Tau]R', 'dNdLog10x[tau]': '\\[Tau]', 'dNdLog10x[u]': 'u'}#
source#

Data source for the spectra.

tag = ['ContinuumPrimaryFlux', 'dm-pf']#

Methods Documentation

evaluate(energy, *args)[source]#

Evaluate the continuum primary flux spectrum dN/dE.

Converts the requested energy to log10(energy / mDM), evaluates the underlying TemplateNDSpectralModel (interpolated over Log[10,x] and mDM) to obtain dN/dlog10(x), and converts this to dN/dE via the Jacobian dN/dE = dN/dlog10(x) / (E * ln(10)).

Parameters:
energyQuantity

Energy values (array-like) at which to evaluate the spectrum.

*args

Additional template axis coordinates required by the parent evaluate (the current mDM value is appended automatically).

Returns:
dN_dEQuantity

Differential photon yield per unit energy.

classmethod from_dict(data)[source]#

Construct a ContinuumPrimaryFlux from a dictionary.

Parameters:
datadict

Dictionary as produced by to_dict, containing mDM and channel, and optionally source (defaults to "pppc4" if absent).

Returns:
fluxContinuumPrimaryFlux

New instance reconstructed from data.

to_dict(full_output=False)[source]#

Serialize the model to a dictionary.

Parameters:
full_outputbool, optional

Unused; present for interface compatibility. Default is False.

Returns:
datadict

Dictionary representation containing the model type, mDM, channel, and source, suitable for round-tripping via from_dict.

__init__(mDM, channel, source=None, mapping_dict=None)[source]#
classmethod __new__(*args, **kwargs)#