asgardpy.gammapy.read_models module¶
Functions for reading different Models type objects with Gammapy objects.
- asgardpy.gammapy.read_models.create_gal_diffuse_skymodel(diff_gal_file)[source]¶
Create SkyModel of the Diffuse Galactic sources either by reading a file or by using a provided Map object.
- Parameters:
diff_gal_file (Path, gammapy.maps.Map) – Path to the isotropic diffuse model file, or a Map object already read from a file.
- Returns:
model (gammapy.modeling.SkyModel) – SkyModel object read from a given galactic diffuse model file.
diff_gal (gammapy.maps.Map) – Map object of the galactic diffuse model
- asgardpy.gammapy.read_models.create_iso_diffuse_skymodel(iso_file, key_name)[source]¶
Create a SkyModel of the Fermi Isotropic Diffuse Model and assigning name as per the observation key. If there are no distinct key types of files, the value is None.
- asgardpy.gammapy.read_models.create_source_skymodel(source_info, dl3_aux_path, base_model_type='Fermi-XML', asgardpy_target_config=None)[source]¶
Build SkyModels from given base model information.
If AsgardpyConfig section of the target is provided for the target source information, it will be used to check if the target source_name is provided in the base_model file. If it exists, then check if the model information is to be read from AsgardpyConfig using from_3d boolean value. Also, if EBL model information is provided in the AsgardpyConfig, it will be added to the SkyModel object.
- Parameters:
source_info (dict) – Dictionary containing the source models information from XML file.
dl3_aux_path (str) – Path location of the DL3 auxiliary files for reading Spatial Models from separate files.
base_model_type (str) – Name indicating the model format used to read the skymodels from.
asgardpy_target_config (AsgardpyConfig) – Config section containing the Target source information.
- Returns:
source_sky_model (gammapy.modeling.SkyModel) – SkyModels object for the given source information.
is_source_target (bool) – Boolean to check if the Models belong to the target source.
- asgardpy.gammapy.read_models.read_fermi_xml_models_list(list_source_models, dl3_aux_path, xml_file, diffuse_models, asgardpy_target_config=None)[source]¶
Read from the Fermi-XML file to enlist the various objects and get their SkyModels.
- Parameters:
list_source_models (list) – List of source models to be filled.
dl3_aux_path (str) – Path location of the DL3 auxiliary files for reading Spatial Models from separate files.
xml_file (str) – Path of the Fermi-XML file to be read.
diffuse_models (dict) – Dict containing diffuse models’ filenames and instrument key.
asgardpy_target_config (AsgardpyConfig) – Config section containing the Target source information.
- Returns:
list_source_models (list) – List of filled source models.
diffuse_models (dict) – Dict containing diffuse models objects replacing the filenames.
- asgardpy.gammapy.read_models.update_aux_info_from_fermi_xml(diffuse_models_file_names_dict, xml_file, fetch_iso_diff=False, fetch_gal_diff=False)[source]¶
When no glob_search patterns on axuillary files are provided, fetch them from the XML file and update the dict containing diffuse models’ file names.
- Parameters:
diffuse_models_file_names_dict (dict) – Dict containing the information on the DL3 files input.
xml_file (str) – Path of the Fermi-XML file to be read.
fetch_iso_diff (bool) – Boolean to get the information of the Isotropic diffuse model from the Fermi-XML file
fetch_gal_diff (bool) – Boolean to get the information of the Galactic diffuse model from the Fermi-XML file
- Returns:
diffuse_models_file_names_dict – Dict containing the updated information on the DL3 files input.
- Return type:
dict