Skip to content
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

Simplify pixel log-likelihood. #1403

Merged
merged 18 commits into from
Oct 14, 2020

Conversation

nbiederbeck
Copy link
Contributor

in the attempt to work on #1272:

  • simplify the log-likelihood analytically
  • discard constants and factors which are not needed in minimization

but now the function ctapipe.image.pixel_likelihood.poisson_likelihood_gaussian is basically the same as ctapipe.image.muon.intensity_fitter.negative_log_likelihood in #1390 and duplicate code is not good.

Maybe do smth like ctapipe.image.pixel_likelihood.negative_log_likelihood and use this in the Muon and ImPACT fitting?

* simplify the log-likelihood analytically
* discard constants and factors which are not needed in minimization
@maxnoe
Copy link
Member

maxnoe commented Jul 28, 2020

Yes, just use this function in the muon code

Reference was already there, so use correct link
and remove reference section in this docstring.
@maxnoe
Copy link
Member

maxnoe commented Aug 7, 2020

Could you also apply the same treatment to the other functions and then use the right one in the muon code?

@nbiederbeck
Copy link
Contributor Author

Could you also apply the same treatment to the other functions and then use the right one in the muon code?

yes

Noah Biederbeck added 8 commits August 17, 2020 11:47
@nbiederbeck nbiederbeck changed the title WIP: Simplify pixel log-likelihood. Simplify pixel log-likelihood. Aug 17, 2020
@nbiederbeck nbiederbeck marked this pull request as ready for review August 17, 2020 10:19
kosack
kosack previously approved these changes Aug 17, 2020
@maxnoe
Copy link
Member

maxnoe commented Sep 14, 2020

@nbiederbeck Tests are failing due to an import error. Somewhere, probably it still imports one of the older names.

There is also a merge conflict now

* change names
* use numpy arrays
* use sum, because we calculate telescope-likelihood not pixel-likelihood
@codecov
Copy link

codecov bot commented Sep 15, 2020

Codecov Report

Merging #1403 into master will increase coverage by 0.37%.
The diff coverage is 98.71%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1403      +/-   ##
==========================================
+ Coverage   90.90%   91.27%   +0.37%     
==========================================
  Files         184      184              
  Lines       12882    12861      -21     
==========================================
+ Hits        11710    11739      +29     
+ Misses       1172     1122      -50     
Impacted Files Coverage Δ
ctapipe/reco/ImPACT.py 44.82% <50.00%> (ø)
ctapipe/image/pixel_likelihood.py 100.00% <100.00%> (+51.02%) ⬆️
ctapipe/image/tests/test_pixel_likelihood.py 100.00% <100.00%> (ø)
ctapipe/instrument/subarray.py 94.35% <0.00%> (-0.13%) ⬇️
ctapipe/image/reducer.py 100.00% <0.00%> (ø)
ctapipe/calib/camera/calibrator.py 100.00% <0.00%> (ø)
ctapipe/image/tests/test_reducer.py 100.00% <0.00%> (ø)
ctapipe/instrument/tests/test_subarray.py 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 052fe3b...49bc6a4. Read the comment docs.

ctapipe/image/pixel_likelihood.py Outdated Show resolved Hide resolved
ctapipe/image/pixel_likelihood.py Outdated Show resolved Hide resolved
* also black fixes that were somehow skipped earlier
Copy link
Contributor

@kosack kosack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

coverage.io mentions a few lines that are not tested in any unit test (see the warnings in the code view), but once those are fixed, I think this is ok.

@maxnoe maxnoe merged commit b2e8ca9 into cta-observatory:master Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants