-
Notifications
You must be signed in to change notification settings - Fork 270
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
Reconstruction fix (also for Divergent Pointing) #946
Conversation
Codecov Report
@@ Coverage Diff @@
## master #946 +/- ##
==========================================
+ Coverage 84.25% 85.53% +1.28%
==========================================
Files 181 183 +2
Lines 10979 11235 +256
==========================================
+ Hits 9250 9610 +360
+ Misses 1729 1625 -104
Continue to review full report at Codecov.
|
Can you create Test cases for the issues you fixed so this does not happen again? |
The HillasIntersector class is not very well tested, so I think I can add some tests. |
What do you mean by not allowed? It used to work (in a very old version, before coordinates were implemented anyhow). In principle, the methodology in HillasReconstructor should be better for divergent pointing, since no Nominal system is needed. The HillasIntersection one was just a copy of the HESS implementation, I think, and is not used anywhere. We should probably decide on a single method. |
Multiple code path in the HillasReconstructor as it is now assume a common pointing position. It it is possible to support divergent pointing in principle, then these code paths must be changed. |
Hi, I agree Karl the HillasReconstructor should work better here where the assumption of a flat nominal system starts to become a bad assumption. I created the HillasIntersection code as a baseline comparison as this is (as far as I know) the way all current instruments do their Hillas reconstruction (and also HillasReconstructor gave weird results at the time). I also agree that we should move towards removing HillasIntersection, but we should probably show the HillasReconstructor gives similar or better results at some point. |
We should probably add a cross-check test between the two implementations, at least for some simple case (non-divergent for now I guess until both support it). |
Agreed - if I recall correctly in HESS, there was a difference between AltAz and Horizon, but it was just related to the refraction correction (it was applied when going from Horizon to AltAz). I think in Astropy, that correction is applied when going from AltAz to ICRS (but we should verify), so there is no difference between Horizon and AltAz |
yes, it looks like AltAz has an optional temperature and pressure option, which implies refraction gets corrected later. (http://docs.astropy.org/en/stable/api/astropy.coordinates.AltAz.html) |
I run the analysis (to produce some angular resolution) on some point gamma produced with MSTs in divergent pointing and it seems it's working well with the 2D reconstruction method. |
ctapipe/reco/hillas_intersection.py
Outdated
@@ -82,7 +82,7 @@ def predict(self, hillas_parameters, tel_x, tel_y, array_direction): | |||
sky_pos = SkyCoord( | |||
az=src_x * u.deg, | |||
alt=src_y * u.deg, | |||
frame=HorizonFrame() | |||
frame=HorizonFrame(location=array_direction.location, obstime=array_direction.obstime) |
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.
Isn't it then SkyCoord(az=..., alt=..., frame=array_direction.frame)
?
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! in this way all the information in the frame should be passed.
So the tests are passing, but diff coverage is zero. So there are no tests covering |
Yes, there need to be some unit tests if we want to keep this class - it's one of the reasons it has not been used. At least similar ones to those in HillasReconstuctor. Ideally, we could have common tests for all reconstructors, but so far the interfaces are not quite uniform. |
Yes I know...I have in my to-do list to add some tests to this class...if someone wants to help, that would be great! |
I'm testing the output of the two reconstructors and it seems that the 3d gives better results that the 2d one (which is what is expected). |
Great! So does it give a significantly better angular resolution or just small improvements? Either way is good, but if it's much better it might be nice to make a plot of this to show to consortium to show that we are able to improve on "standard method" even with a fast Hillas based analysis. |
I tested it on few data and the 3D one is 50% to 100% better :D but i need more data and different pointings in order to be sure about this. And if someone else could do the same check, it would be great. |
Wow! That is impressive, if that holds for all events we should definitely show this somewhere, as I'm not sure that this method has been used by IACTs before. |
Is |
Yes I can remove the flag...it makes more sense to always do the divergent correction when the pointing is not exactly parallel (pointing corrections or divergent mode): I can just check that if the |
More details on the fix for the divergent mode with the |
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.
While you're at it, it would be nice to change all the user-configurable parameters to be Traits and ensure Reconstructors are all sub-classes of Component (just changing the base class should work). Then we would be able to store and retrieve the options like weighting method, etc.
I implemented the suggested modifications (a part for the predict method which I think deserves some discussion). |
A part from codacy complaining, is there any other problem in merging this PR? could someone review it? Should I merge the |
I think we're just waiting for @maxnoe (who's probably quite busy) or @ParsonsRD to give an ok. I Don't see any major issues. merging in master shouldn't be necessary since it doesn't touch any other changed files, but you could do it if you like. The codacy issues look ok - it's mainly complaining about missing docstrings in the tests, which aren't really critical, so I'm ok ignoring that. |
OK I'll try to take a look today |
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.
All the ImPACT changes look good to me
Ok, since we have 2 reviews and Max's requests seem to be addressed, I'll merge this. |
* upstream/master: Reduce numba signatures to improve import time (cta-observatory#1108) Remove unused utils (cta-observatory#1112) Add method to read bright star catalog and find bright stars in sky region (cta-observatory#1105) Add Fields to calibration containers (cta-observatory#1111) Reconstruction fix (also for Divergent Pointing) (cta-observatory#946) updated AUTHORS with latest mailmap
I'm trying to analyze some MC in divergent pointing mode.
The reconstruction was not working out of the box due to few fixes needed to the HillasIntersection class after the coordinates refactoring in #896: seems to be working correctly now...I'm still working on this.
I've not checked the HillasReconstructor in divergent mode (see #873) yet. I just know that divergent pointing is not allowed now with HillasReconstructor.