PowerLaw2SpectralModel#

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

Bases: SpectralModel

Spectral power-law model with integral as amplitude parameter.

For more information see Power law 2 spectral model.

Parameters:
indexQuantity

Spectral index \(\Gamma\). Default is 2.

amplitudeQuantity

Integral flux \(F_0\). Default is 1e-12 cm-2 s-1.

eminQuantity

Lower energy limit \(E_{0, min}\). Default is 0.1 TeV.

emaxQuantity

Upper energy limit \(E_{0, max}\). Default is 100 TeV.

Attributes Summary

amplitude

A model parameter.

default_parameters

emax

A model parameter.

emin

A model parameter.

index

A model parameter.

tag

Methods Summary

evaluate(energy, amplitude, index, emin, emax)

Evaluate the model (static function).

evaluate_integral(energy_min, energy_max, ...)

Integrate power law analytically.

inverse(value, *args)

Return energy for a given function value of the spectral model.

Attributes Documentation

amplitude#

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>#
emax#

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.

emin#

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.

index#

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 = ['PowerLaw2SpectralModel', 'pl-2']#

Methods Documentation

static evaluate(energy, amplitude, index, emin, emax)[source]#

Evaluate the model (static function).

static evaluate_integral(energy_min, energy_max, amplitude, index, emin, emax)[source]#

Integrate power law analytically.

\[F(E_{min}, E_{max}) = F_0 \cdot \frac{E_{max}^{\Gamma + 1} \ - E_{min}^{\Gamma + 1}}{E_{0, max}^{\Gamma + 1} \ - E_{0, min}^{\Gamma + 1}}\]
Parameters:
energy_min, energy_maxQuantity

Lower and upper bound of integration range.

inverse(value, *args)[source]#

Return energy for a given function value of the spectral model.

Parameters:
valueQuantity

Function value of the spectral model.

__init__(**kwargs)#
classmethod __new__(*args, **kwargs)#