add full get_energy_dispersion() method
@@ -136,8 +136,11 @@ class EDispMap(object):
self.edisp_map.interp_by_pix(pix) * u.Unit(self.edisp_map.unit)
)
- e_true = self.edisp_map.geom.axes[1].center * self.edisp_map.geom.axes[1].unit
+ e_trues = self.edisp_map.geom.axes[1].center * self.edisp_map.geom.axes[1].unit
+ data = []
+
+ for e_true in e_trues:
# We now perform integration over migra
# The code is adapted from `~gammapy.EnergyDispersion2D.get_response`
@@ -156,6 +159,16 @@ class EDispMap(object):
# to get integral over reco energy bin
integral = np.diff(tmp[pos_mig])
+ data.append(vec)
+
+ data = np.asarray(data)
+ e_lo, e_hi = e_trues[:-1], e_trues[1:]
+ ereco_lo, ereco_hi = (e_reco[:-1], e_reco[1:])
- # Beware. Need to revert rad and energies to follow the TablePSF scheme.
- return EnergyDependentTablePSF(energy=energies, rad=rad, psf_value=psf_values.T)
+ return EnergyDispersion(
+ e_true_lo=e_lo,
+ e_true_hi=e_hi,
+ e_reco_lo=ereco_lo,
+ e_reco_hi=ereco_hi,
+ data=data,
+ )
