You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running FluxPointsEstimator on a dataset without an edisp gives a very confusing error message ValueError: Can only stack equivalent maps or cutout of the same map.
To Reproduce
Set edisp=None for any dataset (with e_true=e_reco) and proceed with flux points estimation in multiple energy bands (normal use case).
Expected behaviour
The analysis fails (as expected) during the fitting stage if energy_true has a different binning from the energy axis with a more understandable error
File ~/Gammapy-dev/gammapy/gammapy/datasets/evaluator.py:245, in MapEvaluator._edisp_diagonal(self)
242 @lazyproperty
243 def _edisp_diagonal(self):
244 return EDispKernel.from_diagonal_response(
--> 245 energy_axis_true=self.edisp.axes["energy_true"],
246 energy_axis=self.edisp.axes["energy"],
247 )
AttributeError: 'NoneType' object has no attribute 'axes'
However, if the energy_axis and the energy_axis_true have same binning, the fit proceeds fine and then the very confusing error is raised during flux points estimation.
Either the flux estimator (and also the fit) should fail with a decent error message consistently for no edisp OR
the diagonal edisp can be adapted with the energy_axis here
Thanks @AtreyeeS for pointing this out.
I've also note that the same issue happens when running Fit on a dataset without edisp. I think that a possibility should be to operate in Dataset, or even in the Maker, and allow for a default diagonal edisp when the latter is not present. Any opinion about this?
If you have a dataset with energy_true = energy, then it works for the fitting by silently creating a diagonal edisp matrix and fails in the flux estimation.
I propose we either always create a diagonal edisp (with a correct logging info), or we always fail.
Yes, correct. But if you create the dataset without selecting edisp, Fit crashes. I think that we your first option is the most suitable, i.e. it always creates a diagonal matrix and gives an info on that. I wouldn't got with the failing because someone could want to estimate or fit the dataset without including edisp.
Gammapy version
present dev
Bug description
Running
FluxPointsEstimator
on a dataset without anedisp
gives a very confusing error messageValueError: Can only stack equivalent maps or cutout of the same map.
To Reproduce
Set
edisp=None
for any dataset (with e_true=e_reco) and proceed with flux points estimation in multiple energy bands (normal use case).Expected behaviour
The analysis fails (as expected) during the fitting stage if
energy_true
has a different binning from theenergy
axis with a more understandable errorHowever, if the
energy_axis
and theenergy_axis_true
have same binning, the fit proceeds fine and then the very confusing error is raised during flux points estimation.energy_axis
heregammapy/gammapy/datasets/evaluator.py
Line 243 in e9b22cd
to use the dataset energy axis.
The text was updated successfully, but these errors were encountered: