-
Notifications
You must be signed in to change notification settings - Fork 268
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
2-Pass waveform integration à-la-CTA/MARS #1215
2-Pass waveform integration à-la-CTA/MARS #1215
Conversation
…; PEP8-compliant formatting.
ctapipe/image/extractor.py
Outdated
Array containing the sums for each of the kernel positions. | ||
Shape: (n_samples - window_width - 1) | ||
|
||
Dr. Michele Peresano, 2019 |
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.
I'd suggest removing your name here, and instead adding it to the CODEOWERS
file at the top level (we decided against putting names in the comments). You also should also update AUTHORS
and .mailmap
with your information
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.
However, if there is a reference for the MARS analysis, it would be nice to add it also to docs/references.rst
and add a citation link. Note that it should not be in the Returns
section (sphinx won't like that), but in either the description or See Also
section (see https://numpydoc.readthedocs.io/)
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.
I'll try to see what could be the right citation
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.
If I understood it correctly is this the two-pass integration method described in section 4 of https://ui.adsabs.harvard.edu/abs/2006APh....25..391H/abstract ?
If this is correct, then it maybe shouldn't be called CTA/mars analysis :-)
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 Gernot, I apologize for the late reply.
I don't know if the version of the algorithm I coded here comes directly from the reference that you provide (in any case, from what you say it seems a necessary reference to be added to the documentation so I will do it).
I just tried with as much fidelity as possible to translate in ctapipe-language the version that is used inside CTA/MARS.
That is the reason for the name of the PR (if this is what you refer to).
I also explicited in the class documentation that "[...] This is in particular the CTA-MARS version."
.
For me there is no problem in changing names, perhaps we can ask @moralejo for a confirmation on this.
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, the Eventdisplay reference is indeed to be included: I implemented this in MARS for the CTA analysis (it is not used in MAGIC) to get closer to Eventdisplay. Still, in the spirit of having fully independent analysis codes, I just took the idea, "make a time fit with significant pixels, then do a second round of pulse integration on the rest of the pixels using the times 'predicted' by the fit". The implementation was done in a completely independent manner, and it is bound to differ in the details. I do not think it makes much sense to copy every detail of the Mars version for protopipe - as you @HealthyPear realized, some things (like ROOT's "robust" fit details) would take quite some effort and are probably not essential.
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, the Eventdisplay reference is indeed to be included: I implemented this in MARS for the CTA analysis (it is not used in MAGIC) to get closer to Eventdisplay. Still, in the spirit of having fully independent analysis codes, I just took the idea, "make a time fit with significant pixels, then do a second round of pulse integration on the rest of the pixels using the times 'predicted' by the fit". The implementation was done in a completely independent manner, and it is bound to differ in the details.
I will then add the Eventdisplay one; do you have any suggestion for the reference on the CTA/MARS side? Meanwhile, I took the liberty to add the URL of the wiki page as a citation.
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.
I'd suggest removing your name here,
Done
and instead adding it to the
CODEOWERS
file at the top level (we decided against putting names in the comments).
Done - I hope is the correct syntax
You also should also update
AUTHORS
and.mailmap
with your information
I have already done this sometime ago, do I have to change or update something?
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.
I will then add the Eventdisplay one; do you have any suggestion for the reference on the CTA/MARS side? Meanwhile, I took the liberty to add the URL of the wiki page as a citation.
Unfortunately we have no public reference for that, since as I said it is not a method we use in the MAGIC analysis. Wiki page is ok for internal reference.
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.
possibly the ICRC proceeding by Maxim Shayduk - I think that's the origin of the method.
In particular: - array indexes were wrong by 1 - initial window sliding doesn't touch waveform extremes - in 2nd pass windth and shift of out-of-readout predicted times were not modified
ctapipe/image/extractor.py
Outdated
from ctapipe.core import Component | ||
from numba import njit, prange, guvectorize, float64, float32, int64 | ||
|
||
from ctapipe.image.cleaning import number_of_islands, largest_island, tailcuts_clean |
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.
use relative imports here.
@HealthyPear #1267 is merged, if you merge or rebase vs master, this should work now. |
ok lots of discussion here! Thanks for you input |
There are some codacy complaints you should fix |
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.
I think if you fix a few Codacy complaints + implement @watsonjj's suggestion to split the __call__()
function into two sub-methods, it will be ready.
For call, something like:
def __call__(self, waveforms, telid, selected_gain_channel):
charge1, pulse_time1 = self.apply_pass_1(waveforms, telid, selected_gain_channel)
self.apply_pass_2(waveforms, telid, selected_gain_channel, charge1, pulse_time1)
That way, you can just call apply_pass_1 for doing the benchmarks.
Yes, it looks like a neat solution.... Also in between the two, there is the preliminary image cleaning from which the actual return values are obtained by checking the result. |
- call to the class has been splitted, - bugs have been found and fixed following bugfix in unit-test - given the fixed simulated waveform, the relative tolerance for this image extractor can be now pushed down to 7%
Fixes #602
Prerequisites:
Description:
Comparison with CTA-MARS: Calibration protopipe#31 and Comparison with CTA-MARS: Image cleaning & parametrization protopipe#37 for more information)
Caveats:
status,
which acts like a "quality label", so later the user can select events on the basis of image extraction quality for more complex image extractors that allow internal selection (like this one),ctapipe.image.timing_parameters
should be modified in order to use a robust fitting algorithm (likescipy.stats.siegelslopes
), though I couldn't find an easily importable solution which treated also the fit errors.