TemplateNPredModel#
- class gammapy.modeling.models.TemplateNPredModel(map, spectral_model=None, name=None, filename=None, datasets_names=None, copy_data=True)[source]#
Bases:
gammapy.modeling.models.core.ModelBase
Background model.
Create a new map by a tilt and normalization on the available map
- Parameters
- map
Map
Background model map
- spectral_model
SpectralModel
Normalized spectral model, default is
PowerLawNormSpectralModel
- copy_databool
Create a deepcopy of the map data or directly use the original. True by default, can be turned to False to save memory in case of large maps.
- map
Attributes Summary
True energy axis bin centers (
Quantity
)Frozen status of a model, True if all parameters are frozen
A lazy FITS data descriptor.
Parameters (
Parameters
)Methods Summary
copy
(**kwargs)cutout
(position, width[, mode, name])Cutout background model.
evaluate
()Evaluate background model.
freeze
([model_type])Freeze model parameters
from_dict
(data)from_parameters
(parameters, **kwargs)Create model from parameter list
reassign
(datasets_names, new_datasets_names)Reassign a model from one dataset to another
stack
(other[, weights, nan_to_num])Stack background model in place.
to_dict
([full_output])Create dict for YAML serialisation
unfreeze
([model_type])Restore parameters frozen status to default
Attributes Documentation
- covariance#
- default_parameters = <gammapy.modeling.parameter.Parameters object>#
- frozen#
Frozen status of a model, True if all parameters are frozen
- map#
A lazy FITS data descriptor.
- Parameters
- cachebool
Whether to cache the data.
- name#
- parameters#
- spectral_model#
- tag = 'TemplateNPredModel'#
- type#
Methods Documentation
- copy(**kwargs)#
- cutout(position, width, mode='trim', name=None)[source]#
Cutout background model.
- Parameters
- position
SkyCoord
Center position of the cutout region.
- widthtuple of
Angle
Angular sizes of the region in (lon, lat) in that specific order. If only one value is passed, a square region is extracted.
- mode{‘trim’, ‘partial’, ‘strict’}
Mode option for Cutout2D, for details see
Cutout2D
.- namestr
Name of the returned background model.
- position
- Returns
- cutout
TemplateNPredModel
Cutout background model.
- cutout
- evaluate()[source]#
Evaluate background model.
- Returns
- background_map
Map
Background evaluated on the Map
- background_map
- classmethod from_parameters(parameters, **kwargs)#
Create model from parameter list
- Parameters
- parameters
Parameters
Parameters for init
- parameters
- Returns
- model
Model
Model instance
- model
- reassign(datasets_names, new_datasets_names)#
Reassign a model from one dataset to another
- Parameters
- datasets_namesstr or list
Name of the datasets where the model is currently defined
- new_datasets_namesstr or list
Name of the datasets where the model should be defined instead. If multiple names are given the two list must have the save length, as the reassignment is element-wise.
- Returns
- model
Model
Reassigned model.
- model
- stack(other, weights=None, nan_to_num=True)[source]#
Stack background model in place.
Stacking the background model resets the current parameters values.
- Parameters
- other
TemplateNPredModel
Other background model.
- nan_to_num: bool
Non-finite values are replaced by zero if True (default).
- other