asgardpy.data.target module: Classes

Classes containing the Target config parameters for the high-level interface and also the functions involving Models generation and assignment to datasets.

class asgardpy.data.target.BrokenPowerLaw2SpectralModel(**kwargs)[source]

Bases: SpectralModel

Spectral broken power-law 2 model.

In this slightly modified Broken Power Law, instead of having the second index as a distinct parameter, the difference in the spectral indices around the Break Energy is used, to try for some assumptions on the different physical processes that define the full spectrum, where the second process is dependent on the first process.

For more information see Broken power law spectral model.

\[\begin{split}\phi(E) = \phi_0 \cdot \begin{cases} \left( \frac{E}{E_{break}} \right)^{-\Gamma_1} & \text{if } E < E_{break} \\ \left( \frac{E}{E_{break}} \right)^{-(\Gamma_1 + \Delta\Gamma)} & \text{otherwise} \end{cases}\end{split}\]
Parameters:
  • index1 (~astropy.units.Quantity) – \(\Gamma_1\)

  • index_diff (~astropy.units.Quantity) – \(\Delta\Gamma\)

  • amplitude (~astropy.units.Quantity) – \(\phi_0\)

  • ebreak (~astropy.units.Quantity) – \(E_{break}\)

See also

SmoothBrokenPowerLawSpectralModel

static evaluate(energy, index1, index_diff, amplitude, ebreak)[source]

Evaluate the model (static function).

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:
  • name (str) – Name.

  • value (float or ~astropy.units.Quantity) – Value.

  • scale (float, optional) – Scale (sometimes used in fitting).

  • unit (~astropy.units.Unit or str, optional) – Unit.

  • min (float, optional) – Minimum (sometimes used in fitting).

  • max (float, optional) – Maximum (sometimes used in fitting).

  • frozen (bool, optional) – Frozen (used in fitting).

  • error (float) – Parameter error.

  • scan_min (float) – Minimum value for the parameter scan. Overwrites scan_n_sigma.

  • scan_max (float) – Minimum value for the parameter scan. Overwrites scan_n_sigma.

  • scan_n_values (int) – Number of values to be used for the parameter scan.

  • scan_n_sigma (int) – Number of sigmas to scan.

  • scan_values (numpy.array) – Scan values. Overwrites all the scan keywords before.

  • scale_method ({'scale10', 'factor1', None}) – Method used to set factor and scale.

  • interp ({"lin", "sqrt", "log"}) – Parameter scaling to use for the scan.

  • prior (~gammapy.modeling.models.Prior) – Prior set on the parameter.

default_parameters = <gammapy.modeling.parameter.Parameters object>
ebreak

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:
  • name (str) – Name.

  • value (float or ~astropy.units.Quantity) – Value.

  • scale (float, optional) – Scale (sometimes used in fitting).

  • unit (~astropy.units.Unit or str, optional) – Unit.

  • min (float, optional) – Minimum (sometimes used in fitting).

  • max (float, optional) – Maximum (sometimes used in fitting).

  • frozen (bool, optional) – Frozen (used in fitting).

  • error (float) – Parameter error.

  • scan_min (float) – Minimum value for the parameter scan. Overwrites scan_n_sigma.

  • scan_max (float) – Minimum value for the parameter scan. Overwrites scan_n_sigma.

  • scan_n_values (int) – Number of values to be used for the parameter scan.

  • scan_n_sigma (int) – Number of sigmas to scan.

  • scan_values (numpy.array) – Scan values. Overwrites all the scan keywords before.

  • scale_method ({'scale10', 'factor1', None}) – Method used to set factor and scale.

  • interp ({"lin", "sqrt", "log"}) – Parameter scaling to use for the scan.

  • prior (~gammapy.modeling.models.Prior) – Prior set on the parameter.

index1

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:
  • name (str) – Name.

  • value (float or ~astropy.units.Quantity) – Value.

  • scale (float, optional) – Scale (sometimes used in fitting).

  • unit (~astropy.units.Unit or str, optional) – Unit.

  • min (float, optional) – Minimum (sometimes used in fitting).

  • max (float, optional) – Maximum (sometimes used in fitting).

  • frozen (bool, optional) – Frozen (used in fitting).

  • error (float) – Parameter error.

  • scan_min (float) – Minimum value for the parameter scan. Overwrites scan_n_sigma.

  • scan_max (float) – Minimum value for the parameter scan. Overwrites scan_n_sigma.

  • scan_n_values (int) – Number of values to be used for the parameter scan.

  • scan_n_sigma (int) – Number of sigmas to scan.

  • scan_values (numpy.array) – Scan values. Overwrites all the scan keywords before.

  • scale_method ({'scale10', 'factor1', None}) – Method used to set factor and scale.

  • interp ({"lin", "sqrt", "log"}) – Parameter scaling to use for the scan.

  • prior (~gammapy.modeling.models.Prior) – Prior set on the parameter.

index_diff

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:
  • name (str) – Name.

  • value (float or ~astropy.units.Quantity) – Value.

  • scale (float, optional) – Scale (sometimes used in fitting).

  • unit (~astropy.units.Unit or str, optional) – Unit.

  • min (float, optional) – Minimum (sometimes used in fitting).

  • max (float, optional) – Maximum (sometimes used in fitting).

  • frozen (bool, optional) – Frozen (used in fitting).

  • error (float) – Parameter error.

  • scan_min (float) – Minimum value for the parameter scan. Overwrites scan_n_sigma.

  • scan_max (float) – Minimum value for the parameter scan. Overwrites scan_n_sigma.

  • scan_n_values (int) – Number of values to be used for the parameter scan.

  • scan_n_sigma (int) – Number of sigmas to scan.

  • scan_values (numpy.array) – Scan values. Overwrites all the scan keywords before.

  • scale_method ({'scale10', 'factor1', None}) – Method used to set factor and scale.

  • interp ({"lin", "sqrt", "log"}) – Parameter scaling to use for the scan.

  • prior (~gammapy.modeling.models.Prior) – Prior set on the parameter.

tag = ['BrokenPowerLaw2SpectralModel', 'bpl2']
pydantic model asgardpy.data.target.EBLAbsorptionModel[source]

Bases: BaseConfig

Config section for parameters to use for EBLAbsorptionNormSpectralModel.

Fields:
field alpha_norm: float = 1.0
field filename: Annotated[str | Path] = 'None'
Constraints:
  • func = <function <lambda> at 0x7f5167d96020>

  • json_schema_input_type = PydanticUndefined

  • return_type = <class ‘pathlib.Path’>

  • when_used = json-unless-none

field redshift: float = 0.0
field reference: str = ''
field type: str = 'EBLAbsorptionNormSpectralModel'
class asgardpy.data.target.ExpCutoffLogParabolaSpectralModel(**kwargs)[source]

Bases: SpectralModel

Spectral Exponential Cutoff Log Parabola model.

Using a simple template from Gammapy.

\[\phi(E) = \phi_0 \left( \frac{E}{E_0} \right) ^ { - \alpha_1 - \beta \log{ \left( \frac{E}{E_0} \right) }} \cdot \exp(- {(\lambda E})^{\alpha_2})\]
Parameters:
  • amplitude (~astropy.units.Quantity) – \(\phi_0\)

  • reference (~astropy.units.Quantity) – \(E_0\)

  • alpha_1 (~astropy.units.Quantity) – \(\alpha_1\)

  • beta (~astropy.units.Quantity) – \(\beta\)

  • lambda (~astropy.units.Quantity) – \(\lambda\)

  • alpha_2 (~astropy.units.Quantity) – \(\alpha_2\)

static evaluate(energy, amplitude, reference, alpha_1, beta, lambda_, alpha_2)[source]

Evaluate the model (static function).

alpha_1

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:
  • name (str) – Name.

  • value (float or ~astropy.units.Quantity) – Value.

  • scale (float, optional) – Scale (sometimes used in fitting).

  • unit (~astropy.units.Unit or str, optional) – Unit.

  • min (float, optional) – Minimum (sometimes used in fitting).

  • max (float, optional) – Maximum (sometimes used in fitting).

  • frozen (bool, optional) – Frozen (used in fitting).

  • error (float) – Parameter error.

  • scan_min (float) – Minimum value for the parameter scan. Overwrites scan_n_sigma.

  • scan_max (float) – Minimum value for the parameter scan. Overwrites scan_n_sigma.

  • scan_n_values (int) – Number of values to be used for the parameter scan.

  • scan_n_sigma (int) – Number of sigmas to scan.

  • scan_values (numpy.array) – Scan values. Overwrites all the scan keywords before.

  • scale_method ({'scale10', 'factor1', None}) – Method used to set factor and scale.

  • interp ({"lin", "sqrt", "log"}) – Parameter scaling to use for the scan.

  • prior (~gammapy.modeling.models.Prior) – Prior set on the parameter.

alpha_2

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:
  • name (str) – Name.

  • value (float or ~astropy.units.Quantity) – Value.

  • scale (float, optional) – Scale (sometimes used in fitting).

  • unit (~astropy.units.Unit or str, optional) – Unit.

  • min (float, optional) – Minimum (sometimes used in fitting).

  • max (float, optional) – Maximum (sometimes used in fitting).

  • frozen (bool, optional) – Frozen (used in fitting).

  • error (float) – Parameter error.

  • scan_min (float) – Minimum value for the parameter scan. Overwrites scan_n_sigma.

  • scan_max (float) – Minimum value for the parameter scan. Overwrites scan_n_sigma.

  • scan_n_values (int) – Number of values to be used for the parameter scan.

  • scan_n_sigma (int) – Number of sigmas to scan.

  • scan_values (numpy.array) – Scan values. Overwrites all the scan keywords before.

  • scale_method ({'scale10', 'factor1', None}) – Method used to set factor and scale.

  • interp ({"lin", "sqrt", "log"}) – Parameter scaling to use for the scan.

  • prior (~gammapy.modeling.models.Prior) – Prior set on the parameter.

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:
  • name (str) – Name.

  • value (float or ~astropy.units.Quantity) – Value.

  • scale (float, optional) – Scale (sometimes used in fitting).

  • unit (~astropy.units.Unit or str, optional) – Unit.

  • min (float, optional) – Minimum (sometimes used in fitting).

  • max (float, optional) – Maximum (sometimes used in fitting).

  • frozen (bool, optional) – Frozen (used in fitting).

  • error (float) – Parameter error.

  • scan_min (float) – Minimum value for the parameter scan. Overwrites scan_n_sigma.

  • scan_max (float) – Minimum value for the parameter scan. Overwrites scan_n_sigma.

  • scan_n_values (int) – Number of values to be used for the parameter scan.

  • scan_n_sigma (int) – Number of sigmas to scan.

  • scan_values (numpy.array) – Scan values. Overwrites all the scan keywords before.

  • scale_method ({'scale10', 'factor1', None}) – Method used to set factor and scale.

  • interp ({"lin", "sqrt", "log"}) – Parameter scaling to use for the scan.

  • prior (~gammapy.modeling.models.Prior) – Prior set on the parameter.

beta

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:
  • name (str) – Name.

  • value (float or ~astropy.units.Quantity) – Value.

  • scale (float, optional) – Scale (sometimes used in fitting).

  • unit (~astropy.units.Unit or str, optional) – Unit.

  • min (float, optional) – Minimum (sometimes used in fitting).

  • max (float, optional) – Maximum (sometimes used in fitting).

  • frozen (bool, optional) – Frozen (used in fitting).

  • error (float) – Parameter error.

  • scan_min (float) – Minimum value for the parameter scan. Overwrites scan_n_sigma.

  • scan_max (float) – Minimum value for the parameter scan. Overwrites scan_n_sigma.

  • scan_n_values (int) – Number of values to be used for the parameter scan.

  • scan_n_sigma (int) – Number of sigmas to scan.

  • scan_values (numpy.array) – Scan values. Overwrites all the scan keywords before.

  • scale_method ({'scale10', 'factor1', None}) – Method used to set factor and scale.

  • interp ({"lin", "sqrt", "log"}) – Parameter scaling to use for the scan.

  • prior (~gammapy.modeling.models.Prior) – Prior set on the parameter.

default_parameters = <gammapy.modeling.parameter.Parameters object>
lambda_

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:
  • name (str) – Name.

  • value (float or ~astropy.units.Quantity) – Value.

  • scale (float, optional) – Scale (sometimes used in fitting).

  • unit (~astropy.units.Unit or str, optional) – Unit.

  • min (float, optional) – Minimum (sometimes used in fitting).

  • max (float, optional) – Maximum (sometimes used in fitting).

  • frozen (bool, optional) – Frozen (used in fitting).

  • error (float) – Parameter error.

  • scan_min (float) – Minimum value for the parameter scan. Overwrites scan_n_sigma.

  • scan_max (float) – Minimum value for the parameter scan. Overwrites scan_n_sigma.

  • scan_n_values (int) – Number of values to be used for the parameter scan.

  • scan_n_sigma (int) – Number of sigmas to scan.

  • scan_values (numpy.array) – Scan values. Overwrites all the scan keywords before.

  • scale_method ({'scale10', 'factor1', None}) – Method used to set factor and scale.

  • interp ({"lin", "sqrt", "log"}) – Parameter scaling to use for the scan.

  • prior (~gammapy.modeling.models.Prior) – Prior set on the parameter.

reference

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:
  • name (str) – Name.

  • value (float or ~astropy.units.Quantity) – Value.

  • scale (float, optional) – Scale (sometimes used in fitting).

  • unit (~astropy.units.Unit or str, optional) – Unit.

  • min (float, optional) – Minimum (sometimes used in fitting).

  • max (float, optional) – Maximum (sometimes used in fitting).

  • frozen (bool, optional) – Frozen (used in fitting).

  • error (float) – Parameter error.

  • scan_min (float) – Minimum value for the parameter scan. Overwrites scan_n_sigma.

  • scan_max (float) – Minimum value for the parameter scan. Overwrites scan_n_sigma.

  • scan_n_values (int) – Number of values to be used for the parameter scan.

  • scan_n_sigma (int) – Number of sigmas to scan.

  • scan_values (numpy.array) – Scan values. Overwrites all the scan keywords before.

  • scale_method ({'scale10', 'factor1', None}) – Method used to set factor and scale.

  • interp ({"lin", "sqrt", "log"}) – Parameter scaling to use for the scan.

  • prior (~gammapy.modeling.models.Prior) – Prior set on the parameter.

tag = ['ExpCutoffLogParabolaSpectralModel', 'ECLP']
pydantic model asgardpy.data.target.ModelComponent[source]

Bases: BaseConfig

Config section for parameters to use for creating a SkyModel object.

Fields:
field datasets_names: list[str] = ['']
field name: str = ''
field spatial: SpatialModelConfig = SpatialModelConfig(type='', frame='icrs', parameters=[ModelParams(name='', value=1.0, unit=' ', error=0.1, min=0.1, max=10.0, frozen=True)])
field spectral: SpectralModelConfig = SpectralModelConfig(type='', parameters=[ModelParams(name='', value=1.0, unit=' ', error=0.1, min=0.1, max=10.0, frozen=True)], ebl_abs=EBLAbsorptionModel(filename=PosixPath('.'), reference='', type='EBLAbsorptionNormSpectralModel', redshift=0.0, alpha_norm=1.0))
field type: ModelTypeEnum = ModelTypeEnum.skymodel
pydantic model asgardpy.data.target.ModelParams[source]

Bases: BaseConfig

Config section for parameters to use for a basic Parameter object.

Fields:
field error: float = 0.1
field frozen: bool = True
field max: float = 10
field min: float = 0.1
field name: str = ''
field unit: str = ' '
field value: float = 1
pydantic model asgardpy.data.target.SpatialModelConfig[source]

Bases: BaseConfig

Config section for parameters to use for creating a SpatialModel object.

Fields:
field frame: FrameEnum = FrameEnum.icrs
field parameters: list[ModelParams] = [ModelParams(name='', value=1.0, unit=' ', error=0.1, min=0.1, max=10.0, frozen=True)]
field type: str = ''
pydantic model asgardpy.data.target.SpectralModelConfig[source]

Bases: BaseConfig

Config section for parameters to use for creating a SpectralModel object.

Fields:
field ebl_abs: EBLAbsorptionModel = EBLAbsorptionModel(filename=PosixPath('.'), reference='', type='EBLAbsorptionNormSpectralModel', redshift=0.0, alpha_norm=1.0)
field parameters: list[ModelParams] = [ModelParams(name='', value=1.0, unit=' ', error=0.1, min=0.1, max=10.0, frozen=True)]
field type: str = ''
pydantic model asgardpy.data.target.Target[source]

Bases: BaseConfig

Config section for main information on creating various Models.

Fields:
field components: list[ModelComponent] = [ModelComponent(name='', type='SkyModel', datasets_names=[''], spectral=SpectralModelConfig(type='', parameters=[ModelParams(name='', value=1.0, unit=' ', error=0.1, min=0.1, max=10.0, frozen=True)], ebl_abs=EBLAbsorptionModel(filename=PosixPath('.'), reference='', type='EBLAbsorptionNormSpectralModel', redshift=0.0, alpha_norm=1.0)), spatial=SpatialModelConfig(type='', frame='icrs', parameters=[ModelParams(name='', value=1.0, unit=' ', error=0.1, min=0.1, max=10.0, frozen=True)]))]
field covariance: str = ''
field datasets_with_fov_bkg_model: list[str] = []
field from_3d: bool = False
field models_file: Annotated[str | Path] = 'None'
Constraints:
  • func = <function <lambda> at 0x7f5167d96020>

  • json_schema_input_type = PydanticUndefined

  • return_type = <class ‘pathlib.Path’>

  • when_used = json-unless-none

field roi_selection: RoISelectionConfig = RoISelectionConfig(roi_radius=<Quantity 0. deg>, free_sources=[])
field sky_position: SkyPositionConfig = SkyPositionConfig(frame='icrs', lon=<Quantity 0. deg>, lat=<Quantity 0. deg>, radius=<Quantity 0. deg>)
field source_name: str = ''
field use_catalog: CatalogConfig = CatalogConfig(name='', selection_radius=<Quantity 0. deg>, exclusion_radius=<Quantity 0. deg>)
field use_uniform_position: bool = True