DarkMatterSpectralModel#
- class gammapy.astro.darkmatter.DarkMatterSpectralModel[source]#
Bases:
SpectralModelDark matter spectral model.
Computes the differential gamma-ray flux expected from dark matter annihilation or decay in a region with a given astrophysical factor, combining the thermally averaged annihilation cross-section or particle decay lifetime, the chosen primary particle-physics spectrum, and a fit-time normalization scale.
For annihilation, the gamma-ray flux is computed as:
\[\frac{\mathrm d \phi}{\mathrm d E} = \frac{\langle \sigma\nu \rangle}{4\pi k m^2_{\mathrm{DM}}} \frac{\mathrm d N}{\mathrm dE} \times J(\Delta\Omega)\]where \(\langle \sigma\nu \rangle\) is the thermal relic cross-section, \(k\) accounts for the dark matter particle type (Majorana or Dirac), \(m_{\mathrm{DM}}\) is the dark matter mass, \(\mathrm dN/\mathrm dE\) is the primary photon spectrum per annihilation, and \(J(\Delta\Omega)\) is the astrophysical J-factor.
For decay, the flux is computed as:
\[\frac{\mathrm d \phi}{\mathrm d E} = \frac{\Gamma}{4\pi m_{\mathrm{DM}}} \frac{\mathrm d N}{\mathrm dE} \times J(\Delta\Omega)\]where \(\Gamma = 1/\tau\) is the decay rate (inverse lifetime), \(m_{\mathrm{DM}}\) is the dark matter mass, \(\mathrm dN/\mathrm dE\) is the primary photon spectrum per decay, and \(J(\Delta\Omega)\) is the astrophysical D-factor (here denoted generically as the astrophysical factor).
- Parameters:
- mDM
Quantity Dark matter particle mass.
- channelstr
Annihilation/Decay channel for the primary flux spectrum e.g.
"b"for bb̄. SeeContinuumPrimaryFlux.channel_registryfor available channels.- scalefloat, optional
Dimensionless normalization parameter applied multiplicatively to the predicted flux, intended to be left free in spectral fits. Default is 1.
- factor
Quantity, optional Astrophysical factor (integrated squared dark matter density along the line of sight and over the solid angle), needed when a
PointSpatialModelis used for the spatial component. Default is 1 (dimensionless).- zfloat, optional
Redshift of the source. The primary flux is evaluated at the redshifted energy
energy * (1 + z). Default is 0.- kint, optional
Only used in the case of annihilation. Dark matter particle type:
2for Majorana particles (which are their own antiparticles, giving a factor of 2 in the annihilation rate) or4for Dirac particles. Default is 2.- primary_fluxprimary flux model, optional
Primary photon spectrum per annihilation event. Must be an instance of
ContinuumPrimaryFlux. If not provided, a defaultContinuumPrimaryFluxis constructed usingmDMandchannel.- sourcestr, optional
Data source for the spectral tables. Options are:
"pppc4"(default): Cirelli et al. (2011, 2016) PPPC4DMIDtables.
"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).
- A path to a custom file readable by
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]".- annihilationbool
Boolean value indicating if the dark matter spectral model comes from an annihilation or decay scenario. Default is True, which indicates annihilation.
- mDM
References
Examples
This is how to instantiate a
DarkMatterSpectralModel:>>> import astropy.units as u >>> from gammapy.astro.darkmatter import DarkMatterSpectralModel >>> channel = "b" >>> mDM = 5000*u.Unit("GeV") >>> factor = 3.41e19 * u.Unit("GeV2 cm-5") >>> modelDM = DarkMatterSpectralModel(mDM=mDM, channel=channel, factor=factor, annihilation=True) # noqa: E501
Attributes Summary
Use age of univserse as lifetime
Thermally averaged annihilation cross-section.
Annihilation/Decay flag
Channel of the default primary flux spectrum.
Astrophysical Factor.
DM particle type (2: Majorana, 4: Dirac).
Dark matter mass.
Primary flux model.
A model parameter.
Source redshift (must be >= 0).
Methods Summary
evaluate(energy, scale)Evaluate the dark matter annihilation differential flux.
from_dict(data)Construct a
DarkMatterSpectralModelfrom a dictionary.to_dict([full_output])Serialize the model to a dictionary.
Attributes Documentation
- LIFETIME_AGE_OF_UNIVERSE = <Quantity 4.3e+17 s>#
Use age of univserse as lifetime
- THERMAL_RELIC_CROSS_SECTION = <Quantity 3.e-26 cm3 / s>#
Thermally averaged annihilation cross-section.
- annihilation#
Annihilation/Decay flag
- channel#
Channel of the default primary flux spectrum.
- default_parameters = <gammapy.modeling.parameter.Parameters object>#
- factor#
Astrophysical Factor.
- k#
DM particle type (2: Majorana, 4: Dirac).
- mDM#
Dark matter mass.
- primary_flux#
Primary flux model.
- scale#
A model parameter.
Note that the parameter value has been split into a factor and scale like this:
value = factor x scale
Users should interact with the
value,quantityorminandmaxproperties and consider the fact that there is afactorandscalean implementation detail.That was introduced for numerical stability in parameter and error estimation methods, only in the Gammapy optimiser interface do we interact with the
factor,factor_minandfactor_maxproperties, i.e. the optimiser “sees” the well-scaled problem.- Parameters:
- namestr
Name.
- valuefloat or
Quantity Value.
- scalefloat, optional
Scale (sometimes used in fitting).
- unit
Unitor str, optional Unit. Default is “”.
- minfloat, str or
quantity, optional Minimum (sometimes used in fitting). If
None, set tonumpy.nan. Default is None.- maxfloat, str or
quantity, optional Maximum (sometimes used in fitting). Default is
numpy.nan.- frozenbool, optional
Frozen (used in fitting). Default is False.
- errorfloat, optional
Parameter error. Default is 0.
- scan_minfloat, optional
Minimum value for the parameter scan. Overwrites scan_n_sigma. Default is None.
- scan_maxfloat, optional
Maximum value for the parameter scan. Overwrites scan_n_sigma. Default is None.
- scan_n_values: int, optional
Number of values to be used for the parameter scan. Default is 11.
- scan_n_sigmaint, optional
Number of sigmas to scan. Default is 2.
- scan_values: `numpy.array`, optional
Scan values. Overwrites all the scan keywords before. Default is None.
- scale_method{‘scale10’, ‘factor1’, None}, optional
Method used to set
factorandscale. Default is “scale10”.- interp{“lin”, “sqrt”, “log”}, optional
Parameter scaling to use for the scan. Default is “lin”.
- prior
Prior, optional Prior set on the parameter. Default is None.
- tag = ['DarkMatterSpectralModel', 'dm-spectralmodel']#
- z#
Source redshift (must be >= 0).
Methods Documentation
- evaluate(energy, scale)[source]#
Evaluate the dark matter annihilation differential flux.
For annihilation, computes:
flux = scale * factor * THERMAL_RELIC_CROSS_SECTION * primary_flux(energy * (1 + z)) / k / mDM**2 / (4 * pi).For decay, computes:
flux = scale * factor * primary_flux(energy * (1 + z)) / LIFETIME_AGE_OF_UNIVERSE / mDM / (4 * pi). Parameters ———- energy :QuantityEnergy values (array-like) at which to evaluate the flux.
- scalefloat
Current value of the
scalenormalization parameter.
- Returns:
- flux
Quantity Differential gamma-ray flux per unit energy.
- flux
- classmethod from_dict(data)[source]#
Construct a
DarkMatterSpectralModelfrom a dictionary.Reconstructs the
primary_fluxsub-model using the registry of known primary flux types, extracts thescaleparameter value from the serialized parameter list, and passes the remaining fields through to the constructor.- Parameters:
- datadict
Dictionary with a top-level
"spectral"key, as produced byto_dict, containingmDM,channel,factor,z,k,primary_flux, andparameters(includingscale).
- Returns:
- model
DarkMatterSpectralModel New instance reconstructed from
data.
- model
- to_dict(full_output=False)[source]#
Serialize the model to a dictionary.
Extends the base
to_dictoutput withchannel,mDM,factor,z,k, the serializedprimary_flux(via its ownto_dict),source,mapping_dictandannihilation.
- __init__(mDM, channel, *, scale=<Quantity 1.>, factor=1, z=0, k=2, primary_flux=None, source=None, mapping_dict=None, annihilation=True)[source]#
- classmethod __new__(*args, **kwargs)#