Add modif to MapDataset
@@ -913,10 +913,25 @@ class MapDataset(Dataset):
counts = self.counts * mask_safe
background = self.background_model.evaluate() * mask_safe
+
+ if self.counts is not None:
+ counts = self.counts * self.mask_safe
counts = counts.sum_over_axes(keepdims=True)
+ else:
+ counts = None
+
+ if self.exposure is not None:
exposure = _map_spectrum_weight(self.exposure, spectrum)
exposure = exposure.sum_over_axes(keepdims=True)
+ else:
+ exposure = None
+
+ if self.background_model is not None:
+ background = self.background_model.evaluate() * self.mask_safe
background = background.sum_over_axes(keepdims=True)
+ bkg_model = BackgroundModel(background)
+ else:
+ bkg_model = None
# TODO: add edisp and psf
edisp = None
@@ -929,7 +944,11 @@ class MapDataset(Dataset):
return self.__class__(
counts=counts,
exposure=exposure,
+<<<<<<< HEAD
background_model=BackgroundModel(background, name=name),
+=======
+ background_model=bkg_model,
+>>>>>>> Add modif to MapDataset
mask_safe=mask_image,
edisp=edisp,
psf=psf,
