asgardpy.data.dataset_3d module¶
Basic overview¶
The class asgardpy.data.dataset_3d.Datasets3DAnalysisStep gathers information for a list of instruments by using the class asgardpy.data.dataset_3d.Dataset3DGeneration.
The main config for this dataset is defined by asgardpy.data.dataset_3d.Dataset3DConfig which is simply a collection of basic information as defined in asgardpy.data.dataset_3d.Dataset3DBaseConfig. This collection is a combination of asgardpy.io.io.InputConfig and asgardpy.data.dataset_3d.Dataset3DInfoConfig information.
Classes¶
Main classes to define 3D Dataset Config, 3D Dataset Analysis Step and to generate 3D Datasets from given Instruments’ DL3 data from the config.
- pydantic model asgardpy.data.dataset_3d.Dataset3DBaseConfig[source]¶
Bases:
BaseConfigConfig section for 3D DL3 Dataset base information for each instrument.
- Fields:
-
field dataset_info:
Dataset3DInfoConfig= Dataset3DInfoConfig(name='dataset-name', key=[], observation=ObservationsConfig(obs_ids=[], event_type=[], obs_file=PosixPath('.'), obs_time=[], obs_cone=SkyPositionConfig(frame='icrs', lon=<Quantity 0. deg>, lat=<Quantity 0. deg>, radius=<Quantity 0. deg>), required_irfs=['aeff']), map_selection=['counts', 'exposure', 'background', 'psf', 'edisp'], geom=GeomConfig(wcs=WcsConfig(skydir=SkyPositionConfig(frame='icrs', lon=<Quantity 0. deg>, lat=<Quantity 0. deg>, radius=<Quantity 0. deg>), binsize=<Quantity 0.1 deg>, proj='TAN', map_frame_shape=MapFrameShapeConfig(width=<Quantity 5. deg>, height=<Quantity 5. deg>), binsize_irf=<Quantity 0.2 deg>), selection=SelectionConfig(offset_max=<Quantity 2.5 deg>), axes=[MapAxesConfig(name='energy', axis=EnergyAxisConfig(min=<Quantity 1. GeV>, max=<Quantity 1. TeV>, nbins=5, per_decade=True), axis_custom=EnergyEdgesCustomConfig(edges=[], unit='TeV'))], from_events_file=True, reco_psf=False), background=BackgroundConfig(method='reflected', region_finder_method='wobble', parameters={}, exclusion=ExclusionRegionsConfig(target_source=True, regions=[], exclusion_file=PosixPath('.'))), safe_mask=SafeMaskConfig(methods=[], parameters={}), on_region=SkyPositionConfig(frame='icrs', lon=<Quantity 0. deg>, lat=<Quantity 0. deg>, radius=<Quantity 0. deg>), containment_correction=True)¶
-
field dl4_dataset_info:
DL4BaseConfig= DL4BaseConfig(dl4_dataset=InputDL4Config(type='MapDataset', input_dir=PosixPath('.'), glob_pattern={}, dl4_format='gadf'), spectral_energy_range=MapAxesConfig(name='energy', axis=EnergyAxisConfig(min=<Quantity 1. GeV>, max=<Quantity 1. TeV>, nbins=5, per_decade=True), axis_custom=EnergyEdgesCustomConfig(edges=[], unit='TeV')))¶
-
field input_dl3:
list[InputDL3Config] = [InputDL3Config(type='type', input_dir=PosixPath('.'), glob_pattern={})]¶
- pydantic model asgardpy.data.dataset_3d.Dataset3DConfig[source]¶
Bases:
BaseConfigConfig section for a list of all 3D DL3 Datasets information.
- Fields:
-
field instruments:
list[Dataset3DBaseConfig] = [Dataset3DBaseConfig(name='Instrument-name', input_dl3=[InputDL3Config(type='type', input_dir=PosixPath('.'), glob_pattern={})], input_dl4=False, dataset_info=Dataset3DInfoConfig(name='dataset-name', key=[], observation=ObservationsConfig(obs_ids=[], event_type=[], obs_file=PosixPath('.'), obs_time=[], obs_cone=SkyPositionConfig(frame='icrs', lon=<Quantity 0. deg>, lat=<Quantity 0. deg>, radius=<Quantity 0. deg>), required_irfs=['aeff']), map_selection=['counts', 'exposure', 'background', 'psf', 'edisp'], geom=GeomConfig(wcs=WcsConfig(skydir=SkyPositionConfig(frame='icrs', lon=<Quantity 0. deg>, lat=<Quantity 0. deg>, radius=<Quantity 0. deg>), binsize=<Quantity 0.1 deg>, proj='TAN', map_frame_shape=MapFrameShapeConfig(width=<Quantity 5. deg>, height=<Quantity 5. deg>), binsize_irf=<Quantity 0.2 deg>), selection=SelectionConfig(offset_max=<Quantity 2.5 deg>), axes=[MapAxesConfig(name='energy', axis=EnergyAxisConfig(min=<Quantity 1. GeV>, max=<Quantity 1. TeV>, nbins=5, per_decade=True), axis_custom=EnergyEdgesCustomConfig(edges=[], unit='TeV'))], from_events_file=True, reco_psf=False), background=BackgroundConfig(method='reflected', region_finder_method='wobble', parameters={}, exclusion=ExclusionRegionsConfig(target_source=True, regions=[], exclusion_file=PosixPath('.'))), safe_mask=SafeMaskConfig(methods=[], parameters={}), on_region=SkyPositionConfig(frame='icrs', lon=<Quantity 0. deg>, lat=<Quantity 0. deg>, radius=<Quantity 0. deg>), containment_correction=True), dl4_dataset_info=DL4BaseConfig(dl4_dataset=InputDL4Config(type='MapDataset', input_dir=PosixPath('.'), glob_pattern={}, dl4_format='gadf'), spectral_energy_range=MapAxesConfig(name='energy', axis=EnergyAxisConfig(min=<Quantity 1. GeV>, max=<Quantity 1. TeV>, nbins=5, per_decade=True), axis_custom=EnergyEdgesCustomConfig(edges=[], unit='TeV'))))]¶
-
field type:
ReductionTypeEnum= ReductionTypeEnum.cube¶
- class asgardpy.data.dataset_3d.Dataset3DGeneration(log, config_3d_dataset, config_full)[source]¶
Bases:
objectClass for 3D dataset creation based on the config or AsgardpyConfig information provided on the 3D dataset and the target source.
Runs the following steps:
Read the DL3 files of 3D datasets into gammapy readable objects.
Create the base counts Map.
Prepare standard data reduction makers using the parameters passed in the config.
Generate the final dataset.
- generate_dataset(key_name)[source]¶
Generate MapDataset for the given Instrument files using the Counts Map, and IRFs objects.
- generate_diffuse_background_cutout()[source]¶
Perform a cutout of the Diffuse background model with respect to the counts map geom (may improve fitting speed?) and update the main list of models.
- generate_fermi_lat_dataset(non_gadf_file_list, exclusion_regions, key_name)[source]¶
Separate function containing the procedures on creating a Fermi-LAT DL4 dataset.
- generate_gadf_dataset(exclusion_regions, filled_skymodel)[source]¶
Separate function containing the procedures on creating a GADF DL4 dataset.
- get_base_objects(dl3_dir_dict, key, non_gadf_file_list)[source]¶
For a DL3 files type and tag of the ‘mode of observations’ or key (FRONT/00 and BACK/01 for Fermi-LAT in enrico/fermipy files), read the files to appropriate Object type for further analysis.
If there are no distinct key types of files, the value is None.
- load_events(events_file)[source]¶
Loading the events files for the specific “Key” into an EventList object and the GTI information into a GTI object.
- read_to_objects(key_name)[source]¶
For each key type of files, read the files to get the required Gammapy objects for further analyses.
Read the first IO list for events, IRFs and XML files, and then get the Diffuse models files list.
- set_edisp_interpolator()[source]¶
Get the Energy Dispersion Kernel interpolated along true and reconstructed energy of the real counts.
- set_energy_axes()[source]¶
Get the energy axes from the given Detector Response Matrix file.
Needs to be generalized for other possible file structures for other instruments.
- pydantic model asgardpy.data.dataset_3d.Dataset3DInfoConfig[source]¶
Bases:
BaseConfigConfig section for 3D DL3 Dataset Reduction for each instrument.
-
field background:
BackgroundConfig= BackgroundConfig(method='reflected', region_finder_method='wobble', parameters={}, exclusion=ExclusionRegionsConfig(target_source=True, regions=[], exclusion_file=PosixPath('.')))¶
-
field geom:
GeomConfig= GeomConfig(wcs=WcsConfig(skydir=SkyPositionConfig(frame='icrs', lon=<Quantity 0. deg>, lat=<Quantity 0. deg>, radius=<Quantity 0. deg>), binsize=<Quantity 0.1 deg>, proj='TAN', map_frame_shape=MapFrameShapeConfig(width=<Quantity 5. deg>, height=<Quantity 5. deg>), binsize_irf=<Quantity 0.2 deg>), selection=SelectionConfig(offset_max=<Quantity 2.5 deg>), axes=[MapAxesConfig(name='energy', axis=EnergyAxisConfig(min=<Quantity 1. GeV>, max=<Quantity 1. TeV>, nbins=5, per_decade=True), axis_custom=EnergyEdgesCustomConfig(edges=[], unit='TeV'))], from_events_file=True, reco_psf=False)¶
-
field observation:
ObservationsConfig= ObservationsConfig(obs_ids=[], event_type=[], obs_file=PosixPath('.'), obs_time=[], obs_cone=SkyPositionConfig(frame='icrs', lon=<Quantity 0. deg>, lat=<Quantity 0. deg>, radius=<Quantity 0. deg>), required_irfs=['aeff'])¶
-
field on_region:
SkyPositionConfig= SkyPositionConfig(frame='icrs', lon=<Quantity 0. deg>, lat=<Quantity 0. deg>, radius=<Quantity 0. deg>)¶
-
field safe_mask:
SafeMaskConfig= SafeMaskConfig(methods=[], parameters={})¶
-
field background:
- class asgardpy.data.dataset_3d.Datasets3DAnalysisStep(config, log=None, overwrite=True)[source]¶
Bases:
AnalysisStepBaseFrom the given config information, prepare the full list of 3D datasets, iterating over all the Instruments’ information by running the Dataset3DGeneration function.
Also calculate the total number of reconstructed energy bins used and the number of linked model parameters to incorporate in the total number of free model parameters, for the final estimation of total number of degrees of freedom.
- link_diffuse_models(models_final, free_params)[source]¶
Function to link the diffuse models if present and reduce the number of degrees of freedom.
- update_model_dataset_names(models, dataset, models_final)[source]¶
Function assigning datasets_names and including them in the final model list.
When no associated list of models are provided, look for a separate model for target and an entry of catalog to fill in.
- tag = 'datasets-3d'¶