-
Notifications
You must be signed in to change notification settings - Fork 77
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
Sensitivity fixes #157
Sensitivity fixes #157
Conversation
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.
Hi.
Updating the code would be the perfect moment to improve its reading with more explicit names.
I reviewed a couple of things that can be improved (probably not exhaustive).
Also, adding unit tests (especially where they were already bugs! - so they don't happen again) would improve a lot the code.
@vuillaut I implemented all the suggested changes, thanks very much for the review and sorry for the big delay! |
Hey @rlopezcoto, thank you very much. |
@vuillaut can we merge this one? |
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.
Hi.
there are still a few changes required for functions to work.
Could you add some unit tests, please?
-> maybe not a unit test for each function but at least a high-level one once the dl2 file has been created by the chain to make sure the functions work in principle and show how the user should make the sensitivity computation?
lstchain/mc/sensitivity.py
Outdated
'eff_gamma', 'eff_hadron', | ||
'nevents_g', 'nevents_p']) | ||
|
||
units = [E.unit, E.unit,"", t.unit,"", "", | ||
units = [energy.unit, energy.unit,"", t.unit,"", "", |
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.
t is not defined now, "theta2_bins"?
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.
Thanks @SeiyaNozaki for spotting the new problems in the PR!
Fixes to the scripts by @vuillaut
Thanks to @vuillaut for the changes as well! Not sure what is breaking the tests, but we have two options:
|
I'm looking into the unit test issue. |
Hi, I used the creation of a fake proton file as described by @vuillaut in this PR (sorry, but I could not merge it because there were conflicts and had to solve the issues quickly). |
Thank you @rlopezcoto ! |
After debugging, together with @moralejo, the sensitivity code, I update here the code with some cleanup. Main changes are:
crab_hegra
everywhere for the sensitivity calculations. There was some inconsistency when transforming from percentage of Crab tu flux units.I also cleaned up the code, but we are still missing some variable clearer names, I'll work on it in the future. Just to report here, during all the debugging we did with @moralejo, we compared all the results at the DL2 level and beyond with those obtained using a Mars-based analysis and everything was equivalent.