add bkg padding option in MapDatasetMaker
@@ -35,6 +35,10 @@ class MapDatasetMaker(Maker):
background_interp_missing_data: bool
Interpolate missing values in background 3d map.
Default is True, have to be set to True for CTA IRF.
+ background_pad_offset: bool
+ Pad one bin in offset for 2d background map.
+ This avoid extrapolation at edges and use the nearest value.
+ Default is True, have to be set to True for HESS IRF.
Examples
--------
@@ -102,9 +106,11 @@ class MapDatasetMaker(Maker):
selection=None,
background_oversampling=None,
background_interp_missing_data=True,
+ background_pad_offset=True,
):
self.background_oversampling = background_oversampling
self.background_interp_missing_data = background_interp_missing_data
+ self.background_pad_offset = background_pad_offset
if selection is None:
selection = self.available_selection
@@ -223,6 +229,9 @@ class MapDatasetMaker(Maker):
if self.background_interp_missing_data:
bkg.interp_missing_data(axis_name="energy")
+ if self.background_pad_offset and bkg.has_offset_axis:
+ bkg = bkg.pad(1, mode="edge", axis_name="offset")
+
return make_map_background_irf(
pointing=observation.fixed_pointing_info,
ontime=observation.observation_time_duration,
