EBLAbsorptionNormSpectralModel#

class gammapy.modeling.models.EBLAbsorptionNormSpectralModel[source]#

Bases: SpectralModel

Gamma-ray absorption models.

For more information see EBL absorption spectral model.

Parameters:
energyQuantity

Energy node values.

paramQuantity

Parameter node values.

dataQuantity

Model value.

redshiftfloat

Redshift of the absorption model. Default is 0.1.

alpha_norm: float

Norm of the EBL model. Default is 1.

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

alpha_norm

A model parameter.

default_parameters

redshift

A model parameter.

tag

Methods Summary

evaluate(energy, redshift, alpha_norm)

Evaluate model for energy and parameter value.

from_dict(data, **kwargs)

read(filename[, redshift, alpha_norm, ...])

Build object from an XSPEC model.

read_builtin([reference, redshift, ...])

Read from one of the built-in absorption models.

to_dict([full_output])

Create dictionary for YAML serialisation.

Attributes Documentation

alpha_norm#

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, quantity or min and max properties and consider the fact that there is a factor and scale an 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_min and factor_max properties, i.e. the optimiser “sees” the well-scaled problem.

Parameters:
namestr

Name.

valuefloat or Quantity

Value.

scalefloat, optional

Scale (sometimes used in fitting).

unitUnit or str, optional

Unit. Default is “”.

minfloat, str or quantity, optional

Minimum (sometimes used in fitting). If None, set to numpy.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 factor and scale. Default is “scale10”.

interp{“lin”, “sqrt”, “log”}, optional

Parameter scaling to use for the scan. Default is “lin”.

priorPrior, optional

Prior set on the parameter. Default is None.

default_parameters = <gammapy.modeling.parameter.Parameters object>#
redshift#

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, quantity or min and max properties and consider the fact that there is a factor and scale an 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_min and factor_max properties, i.e. the optimiser “sees” the well-scaled problem.

Parameters:
namestr

Name.

valuefloat or Quantity

Value.

scalefloat, optional

Scale (sometimes used in fitting).

unitUnit or str, optional

Unit. Default is “”.

minfloat, str or quantity, optional

Minimum (sometimes used in fitting). If None, set to numpy.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 factor and scale. Default is “scale10”.

interp{“lin”, “sqrt”, “log”}, optional

Parameter scaling to use for the scan. Default is “lin”.

priorPrior, optional

Prior set on the parameter. Default is None.

tag = ['EBLAbsorptionNormSpectralModel', 'ebl-norm']#

Methods Documentation

evaluate(energy, redshift, alpha_norm)[source]#

Evaluate model for energy and parameter value.

classmethod from_dict(data, **kwargs)[source]#
classmethod read(filename, redshift=0.1, alpha_norm=1, interp_kwargs=None)[source]#

Build object from an XSPEC model.

Parameters:
filenamestr

File containing the model.

redshiftfloat, optional

Redshift of the absorption model. Default is 0.1.

alpha_norm: float, optional

Norm of the EBL model. Default is 1.

interp_kwargsdict, optional

Interpolation option passed to ScaledRegularGridInterpolator. Default is None.

classmethod read_builtin(reference='dominguez', redshift=0.1, alpha_norm=1, interp_kwargs=None)[source]#

Read from one of the built-in absorption models.

Parameters:
reference{‘franceschini’, ‘dominguez’, ‘finke’}, optional

Name of one of the available model in gammapy-data. Default is ‘dominquez’.

redshiftfloat, optional

Redshift of the absorption model. Default is 0.1.

alpha_normfloat, optional

Norm of the EBL model. Default is 1.

interp_kwargsdict, optional

Interpolation keyword arguments. Default is None.

References

to_dict(full_output=False)[source]#

Create dictionary for YAML serialisation.

__init__(energy, param, data, redshift, alpha_norm, interp_kwargs=None)[source]#
classmethod __new__(*args, **kwargs)#