Adding make_meta_info to makers.map
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import logging
+from astropy.table import Table
+import astropy.units as u
from gammapy.datasets import MapDataset
from gammapy.irf import EnergyDependentMultiGaussPSF
from gammapy.maps import Map
@@ -224,6 +226,32 @@ class MapDatasetMaker:
exposure_map=exposure,
)
+ def make_meta_table(self, observation):
+ """Make info meta table.
+
+ Parameters
+ ----------
+ observation : `~gammapy.data.Observation`
+ Observation
+
+ Returns
+ -------
+ info_table: `~astropy.table.Table`
+ """
+ info_table = Table()
+ info_table["TELESCOP"] = [observation.aeff.meta["TELESCOP"]]
+ info_table["INSTRUME"] = [observation.aeff.meta["INSTRUME"]]
+ info_table["NAME"] = [observation.aeff.meta["CBD10001"][5:-1]]
+ info_table["OBS_ID"] = [observation.obs_id]
+ # NOT WORK YET
+ # info_table['AZ'] = [observation.pointing_altaz.az]
+ # info_table['ALT'] = [observation.pointing_altaz.alt]
+
+ info_table["RA_PNT"] = [observation.pointing_radec.icrs.ra.deg] * u.deg
+ info_table["DEC_PNT"] = [observation.pointing_radec.icrs.dec.deg] * u.deg
+
+ return info_table
+
def run(self, dataset, observation):
"""Make map dataset.
@@ -240,6 +268,7 @@ class MapDatasetMaker:
Map dataset.
"""
kwargs = {"gti": observation.gti}
+ kwargs["obs_info"] = self.make_meta_table(observation)
mask_safe = Map.from_geom(dataset.counts.geom, dtype=bool)
mask_safe.data |= True
