gammapy/enrico

Unbinned Analysis Fails Due to Wrong evfile (in master branch commit 2af1f67993c0f0cf2f3d41bb8498e68797d74e69)

Closed this issue · 3 comments

I've spent the past week, off and on, trying to figure out this issue. Finally figured it out after I figured out well enough how enrico works (in particular the workflow of the code). So doing unbinned analysis, I would consistently (tried multiple times with 3FGL J0001.2-0748, and once with PG 1553 per Rodrigo Nemmen's enrico tutorial (https://github.com/rsnemmen/Fermi-LAT-tutorial)) receive the following error:

RuntimeError: Event::diffuseResponse:
Diffuse component p8r2_source_v6__galdiffmodel does not have an associated diffuse response.

I tracked the issue down to the wrong evfile being passed to UnbinnedObs in fitmaker.py. The original evfile given was self.obs.eventfile. But this passed the *Evt.fits file to UnbinnedObs. The correct file to pass is *MkTime.fits. So self.obs.mktimefile needed to be passed. (for reference: this is on line 100 of fitmaker.py)

Upon changing this (and recompiling fitmaker.py for completeness), the unbinned analysis was able to finish without any errors (some warnings due to low TS, but that was expected due to the small time range I was testing).

Just thought I would create an issue to document the problem and solution. I would create a pull request if I could, but obviously don't have the permissions. So I figured I'd make the information available to the devs.

Edit: To be clear, Rodrigo Nemmen's tutorial does not use unbinned likelihood. I just used the same source since it made for a second source to test, and I already knew that it (along with 3FGL J0001.2-0748) worked with binned likelihood with enrico.

Hi
thanks for this. Please create a pull request to fix this bug
thanks again
best
david

You're welcome. I created a pull request (just forgot I hadn't added a fork to my account earlier).
Adam

thanks a lot for spoting the bug