-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug fix in full numeric pixel likelihood calculation #2388
Conversation
What exactly is isort complaining about here? |
Probably you haven't sorted your imports according to the standard scriptures of Do note that it's not actually |
ctapipe/image/pixel_likelihood.py
Outdated
@@ -121,8 +120,9 @@ def neg_log_likelihood_numeric( | |||
Width of single p.e. peak (:math:`σ_γ`). | |||
pedestal: ndarray | |||
Width of pedestal (:math:`σ_p`). | |||
confidence: tuple(float, float), 0 < x < 1 | |||
Confidence interval of poisson integration. | |||
confidence: loat, 0 < x < 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably mean float
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed it
@gschwefer If you enable the |
What is the actual bug here? I see that you re-introduce terms that are constant under minimization of the likelihood, which is probably the reason why they were left out. I guess using factorial is pretty slow, here is the optimized implementation of the poisson related functions in numba-stats: |
Ok, so these are a couple of different things: The terms in the |
The factorial I'm happy to switch out. |
Measure before :) |
…tapipe into pixel-likelihood-fix
For arrays of k or lambda, |
Ok, maybe I just don't see it, but my version of numba_stats (1.3.0) doesn't seem to support arrays as input for lambda. And that's what really needed here... |
Indeed, I only tested arrays for k, I'll open an issue |
This fixes a bug in the implementation of the full numeric pixel likelihood from de Naurois 2009 , eq 21, in
neg_log_likelihood_numeric
. The approximate likelihood inneg_log_likelihood_approx
is adjusted for consistency, which is important given they are combined in theneg_log_likelihood
function. This was not caught in the tests because these also had a bug, which is now fixed too.I will also implement the fix in the ImPACT branch where the overall pixel likelihood interface changes.