ContinuumPrimaryFlux#
- class gammapy.astro.darkmatter.ContinuumPrimaryFlux[source]#
Bases:
TemplateNDSpectralModelContinuum 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
TemplateNDSpectralModelover a 2D grid of (Log[10,x],mDM), enabling interpolation in dark matter mass while keepingmDMitself frozen as a model parameter.- Parameters:
- mDM
Quantity 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̄. Seeallowed_channelsfor the full list of supported channel labels. Availability of a given channel may depend onsource.- 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 applyingmapping_dictif 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
sourceis a custom file path. Format is{actual_column_name: expected_column_name}, and must cover the mandatory columns"mDM"and"Log[10,x]".
- mDM
Notes
Internally, the spectral table is read and reshaped into a 2D
RegionGeomover (Log[10,x],mDM) axes, wrapped in aMap, and passed to theTemplateNDSpectralModelconstructor with linear interpolation and zero-valued extrapolation. Themassparameter inherited fromTemplateNDSpectralModelis frozen after initialization, sincemDMis treated as a fixed configuration value rather than a fit parameter.References
Attributes Summary
List of allowed annihilation channels.
Annihilation channel as a string.
Dark matter mass.
Mapping dictionary for the spectra file.
Data source for the spectra.
Methods Summary
evaluate(energy, *args)Evaluate the continuum primary flux spectrum dN/dE.
from_dict(data)Construct a
ContinuumPrimaryFluxfrom 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
energytolog10(energy / mDM), evaluates the underlyingTemplateNDSpectralModel(interpolated overLog[10,x]andmDM) to obtaindN/dlog10(x), and converts this todN/dEvia the JacobiandN/dE = dN/dlog10(x) / (E * ln(10)).
- classmethod from_dict(data)[source]#
Construct a
ContinuumPrimaryFluxfrom a dictionary.- Parameters:
- datadict
Dictionary as produced by
to_dict, containingmDMandchannel, and optionallysource(defaults to"pppc4"if absent).
- Returns:
- flux
ContinuumPrimaryFlux New instance reconstructed from
data.
- flux
- 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, andsource, suitable for round-tripping viafrom_dict.
- classmethod __new__(*args, **kwargs)#