TemplateNPredModel#
- class gammapy.modeling.models.TemplateNPredModel[source]#
Bases:
ModelBaseBackground 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. Default is True. Use False to save memory in case of large maps.
- spatial_model
SpatialModel Unitless Spatial model (unit is dropped on evaluation if defined). Default is None.
- map
Attributes Summary
True energy axis bin centers as a
Quantity.Evaluation radius as a
Angle.A lazy FITS data descriptor.
Parameters as a
Parametersobject.List of unique parameter names.
Position as a
SkyCoord.Spectral model as a
SpectralModelobject.Methods Summary
copy([name, copy_data])Copy template npred model.
cutout(position, width[, mode, name])Cutout background model.
evaluate()Evaluate background model.
freeze([model_type])Freeze model parameters.
from_dict(data, **kwargs)slice_by_energy([energy_min, energy_max, name])Select and slice model template in energy range.
stack(other[, weights, nan_to_num])Stack background model in place.
to_dict([full_output])Create dictionary for YAML serialisation.
unfreeze([model_type])Restore parameters frozen status to default.
write([overwrite])Write the map.
Attributes Documentation
- default_parameters = <gammapy.modeling.parameter.Parameters object>#
- map#
A lazy FITS data descriptor.
- Parameters:
- cachebool
Whether to cache the data.
- name#
- parameters#
- parameters_unique_names#
List of unique parameter names. Return formatted as par_type.par_name.
- spectral_model#
Spectral model as a
SpectralModelobject.
- tag = 'TemplateNPredModel'#
Methods Documentation
- copy(name=None, copy_data=False, **kwargs)[source]#
Copy template npred model.
- Parameters:
- namestr, optional
Assign a new name to the copied model. Default is None.
- copy_databool, optional
Copy the data arrays attached to models. Default is False.
- **kwargsdict
Keyword arguments forwarded to
TemplateNPredModel.
- Returns:
- model
TemplateNPredModel Copied template npred model.
- model
- 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. Default is “trim”.- namestr, optional
Name of the returned background model. Default is None.
- position
- Returns:
- cutout
TemplateNPredModel Cutout background model.
- cutout
- evaluate()[source]#
Evaluate background model.
- Returns:
- background_map
Map Background evaluated on the Map.
- background_map
- slice_by_energy(energy_min=None, energy_max=None, name=None)[source]#
Select and slice model template in energy range.
- Parameters:
- energy_min, energy_max
Quantity Energy bounds of the slice. Default is None.
- namestr
Name of the sliced model. Default is None.
- energy_min, energy_max
- Returns:
- model
TemplateNpredModel Sliced 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.
- weightsfloat, optional
Weights. Default is None.
- nan_to_num: bool, optional
Non-finite values are replaced by zero if True. Default is True.
- other
- write(overwrite=False)[source]#
Write the map.
- Parameters:
- overwrite: bool, optional
Overwrite existing file. Default is False, which will raise a warning if the template file exists already.
- __init__(map, spectral_model=None, name=None, filename=None, datasets_names=None, copy_data=True, spatial_model=None, covariance_data=None)[source]#
- classmethod __new__(*args, **kwargs)#