asgardpy.gammapy.interoperate_models module¶
Functions for having interoperatibility of Models type objects with Gammapy objects.
- asgardpy.gammapy.interoperate_models.get_gammapy_spectral_model(spectrum_type, ebl_atten=False, base_model_type='Fermi-XML')[source]¶
Getting the correct Gammapy SpectralModel object after reading a name from a different base_model_type.
Parameter¶
- spectrum_type: str
Spectral Model type as written in the base model.
- ebl_atten: bool
If EBL attenuated spectral model needs different treatment.
- base_model_type: str
Name indicating the XML format used to read the skymodels from.
- returns:
spectral_model (gammapy.modleing.models.SpectralModel) – Gammapy SpectralModel object corresponding to the provided name.
ebl_atten (bool) – Boolean for EBL attenuated spectral model.
- asgardpy.gammapy.interoperate_models.params_renaming_to_gammapy(params_1_name, params_gpy, spectrum_type, params_1_base_model='Fermi-XML')[source]¶
Reading from a given parameter name, get basic parameters details like name, unit and is_norm as per Gammapy definition.
This function collects all such switch cases, based on the base model of the given set of parameters.
- asgardpy.gammapy.interoperate_models.params_rescale_to_gammapy(params_gpy, spectrum_type, en_scale_1_to_gpy=1e-06, keep_sign=False)[source]¶
Rescaling parameters to be used with Gammapy standard units, by using the various physical factors (energy for now), compared with the initial set of parameters as compared with Gammapy standard units.
Also, scales the value, min and max of the given parameters, depending on their Parameter names.
- asgardpy.gammapy.interoperate_models.xml_spatial_model_to_gammapy(aux_path, xml_spatial_model, base_model_type='Fermi-XML')[source]¶
Read the spatial model component of the XMl model to Gammapy SpatialModel object.
Details of the Fermi-XML model can be seen at https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/source_models.html and with examples at https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/xml_model_defs.html
- Parameters:
aux_path (Path) – Path to the template diffuse models
xml_spatial_model (dict) – Spatial Model component of a particular source from the XML file
base_model_type (str) – Name indicating the XML format used to read the skymodels from.
- Returns:
spatial_model – Gammapy Spatial Model object
- Return type:
gammapy.modeling.models.SpatialModel
- asgardpy.gammapy.interoperate_models.xml_spectral_model_to_gammapy(params, spectrum_type, is_target=False, keep_sign=False, base_model_type='Fermi-XML')[source]¶
Convert the Spectral Models information from XML model of FermiTools to Gammapy standards and return Parameters list. Details of the XML model can be seen at https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/source_models.html and with examples at https://fermi.gsfc.nasa.gov/ssc/data/analysis/scitools/xml_model_defs.html
Models from the XML model, not read in Gammapy are - ExpCutoff (Blazar modeling with EBL absorption included), BPLExpCutoff, PLSuperExpCutoff3 (Pulsar modeling), BandFunction (GRB analysis) - If a user requires these functions, they can create corresponding Gammapy SpectralModel classes in asgardpy.data.target and update the SPECTRAL_MODEL_REGISTRY used in asgardpy.
- Parameters:
params (gammapy.modeling.Parameters) – List of gammapy Parameter object of a particular Model
spectrum_type (str) – Spectrum type as defined in XML. To be used only for special cases like PLSuperExpCutoff, PLSuperExpCutoff2 and PLSuperExpCutoff4
is_target (bool) – Boolean to check if the given list of Parameters belong to the target source model or not.
keep_sign (bool) – Boolean to keep the same sign on the parameter values or not.
base_model_type (str) – Name indicating the XML format used to read the skymodels from.
- Returns:
params_final – Final list of gammapy Parameter object
- Return type:
gammapy.modeling.Parameters
Spectral model parameter renaming to Gammapy default¶