Fix evaluation of PointSpatialModel
@@ -2246,7 +2246,6 @@ class MapEvaluator:
raise ValueError(f"Invalid evaluation_mode: {evaluation_mode!r}")
self.evaluation_mode = evaluation_mode
- self.psf_after_edisp = False
# TODO: this is preliminary solution until we have further unified the model handling
if isinstance(self.model, BackgroundModel) or self.model.spatial_model is None:
@@ -2324,10 +2323,8 @@ class MapEvaluator:
)
if isinstance(psf, PSFMap):
- energy_axis_psf = psf.psf_map.geom.axes["energy_true"]
- if energy_axis.is_aligned(energy_axis_psf):
- geom = geom.to_image()
- self.psf_after_edisp = True
+ if self.apply_psf_after_edisp:
+ geom = geom.as_energy_true
else:
geom = exposure.geom
@@ -2456,6 +2453,12 @@ class MapEvaluator:
return npred
+ @property
+ def apply_psf_after_edisp(self):
+ """"""
+ if not isinstance(self.model, BackgroundModel):
+ return self.model.apply_irf.get("psf_after_edisp")
+
# TODO: remove again if possible...
def _compute_npred_psf_after_edisp(self):
if isinstance(self.model, BackgroundModel):
@@ -2481,7 +2484,7 @@ class MapEvaluator:
npred : `~gammapy.maps.Map`
Predicted counts on the map (in reco energy bins)
"""
- if self.psf_after_edisp:
+ if self.apply_psf_after_edisp:
return self._compute_npred_psf_after_edisp()
if self.parameters_changed or not self.use_cache:
