Absorption

class gammapy.modeling.models.Absorption(energy, param, data, filename=None, interp_kwargs=None)[source]

Bases: object

Gamma-ray absorption models.

For more information see Absorption Spectral Model.

Parameters
energyQuantity

Energy node values

paramQuantity

Parameter node values

dataQuantity

Model value

filenamestr

Filename of the absorption model used for serialisation.

interp_kwargsdict

Interpolation option passed to ScaledRegularGridInterpolator. By default the models are extrapolated outside the range. To prevent this and raise an error instead use interp_kwargs = {“extrapolate”: False}

Attributes Summary

tag

Methods Summary

evaluate(self, energy, parameter)

Evaluate model for energy and parameter value.

from_dict(data)

read(filename[, interp_kwargs])

Build object from an XSPEC model.

read_builtin(name[, interp_kwargs])

Read one of the built-in absorption models.

table_model(self, parameter)

Table model for a given parameter value.

to_dict(self)

Attributes Documentation

tag = 'Absorption'

Methods Documentation

evaluate(self, energy, parameter)[source]

Evaluate model for energy and parameter value.

classmethod from_dict(data)[source]
classmethod read(filename, interp_kwargs=None)[source]

Build object from an XSPEC model.

Todo: Format of XSPEC binary files should be referenced at https://gamma-astro-data-formats.readthedocs.io/en/latest/

Parameters
filenamestr

File containing the model.

interp_kwargsdict

Interpolation option passed to ScaledRegularGridInterpolator.

Returns
absorptionAbsorption

Absorption model.

classmethod read_builtin(name, interp_kwargs=None)[source]

Read one of the built-in absorption models.

Parameters
name{‘franceschini’, ‘dominguez’, ‘finke’}

name of one of the available model in gammapy-data

Returns
absorptionAbsorption

Absorption model.

References

1

Franceschini et al., “Extragalactic optical-infrared background radiation, its time evolution and the cosmic photon-photon opacity”, Link

2

Dominguez et al., ” Extragalactic background light inferred from AEGIS galaxy-SED-type fractions” Link

3

Finke et al., “Modeling the Extragalactic Background Light from Stars and Dust” Link

table_model(self, parameter)[source]

Table model for a given parameter value.

Parameters
parameterfloat

Parameter value.

Returns
template_modelTemplateSpectralModel

Template spectral model.

to_dict(self)[source]