asgardpy.data.target module: Functions¶
- asgardpy.data.target.set_models(config_target, datasets, datasets_name_list=None, models=None)[source]¶
Set models on given Datasets.
- Parameters:
config_target (AsgardpyConfig.target) – AsgardpyConfig containing target information.
datasets (gammapy.datasets.Datasets) – Datasets object
dataset_name_list (list) – List of datasets_names to be used on the Models, before assigning them to the given datasets.
models (~gammapy.modeling.models.Models or str of file location or None) – Models object or YAML models string
- Returns:
datasets – Datasets object with Models assigned.
- Return type:
gammapy.datasets.Datasets
- asgardpy.data.target.config_to_dict(model_config)[source]¶
Convert the Spectral/Spatial models into dict. Probably an extra step and maybe removed later.
Parameter¶
- model_config: AsgardpyConfig
Config section containing Target Model SkyModel components only.
- returns:
model_dict – dictionary of the particular model.
- rtype:
dict
- asgardpy.data.target.apply_models_mask_in_roi(list_sources_excluded, target_source, roi_radius, free_sources)[source]¶
Function to apply a selection mask on a given list of models in a given RoI.
The target source position is considered as the center of RoI.
For a given list of non free sources, the spectral amplitude is left unfrozen or allowed to vary.
- asgardpy.data.target.get_models_from_catalog(config_target, center_position_gal)[source]¶
From a given catalog in Gammapy, get a list of source SkyModels around the target source as per the config information.
- Parameters:
config_target (asgardpy.config.generator.AsgardpyConfig.target) – Config information on the target source.
center_position_gal (astropy.coordinates.Galactic) – Central location of the target source in galactic coordinates.
Returns
list_source_models (list) – List of catalog source models around the target source.
- asgardpy.data.target.apply_selection_mask_to_models(list_sources, target_source=None, selection_mask=None, roi_radius=<Quantity 0. deg>, free_sources=None)[source]¶
For a given list of source models, with a given target source, apply various selection masks on the Region of Interest in the sky. This will lead to complete exclusion of models or freezing some or all spectral parameters. These selections excludes the diffuse background models in the given list.
First priority is given if a distinct selection mask is provided, with a list of excluded regions to return only the source models within the selected ROI.
Second priority is on creating a Circular ROI as per the given radius, and freeze all the spectral parameters of the models of the sources.
Third priority is when a list of free_sources is provided, then the spectral amplitude of models of those sources, if present in the given list of models, will be unfrozen, and hence, allowed to be variable for fitting.
- Parameters:
list_sources ('~gammapy.modeling.models.Models') – Models object containing a list of source models.
target_source ('str') – Name of the target source, whose position is used as the center of ROI.
selection_mask ('WcsNDMap') – Map containing a boolean mask to apply to Models object.
roi_radius ('astropy.units.Quantity' or 'asgardpy.data.base.AngleType') – Radius for a circular region around ROI (deg)
free_sources ('list') – List of source names for which the spectral amplitude is to be kept free.
- Returns:
list_sources – Selected Models object.
- Return type:
‘~gammapy.modeling.models.Models’
- asgardpy.data.target.read_models_from_asgardpy_config(config)[source]¶
Reading Models information from AsgardpyConfig and return Models object. If a FoVBackgroundModel information is provided, it will also be added.
Parameter¶
- config: AsgardpyConfig
Config section containing Target source information
- returns:
models – Full gammapy Models object.
- rtype:
gammapy.modeling.models.Models