-
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
Hillas psi uncertainty ruo #2629
base: main
Are you sure you want to change the base?
Conversation
…sContainer Field b_uncertainty: deg (angle) and m (length) are not convertible
src/ctapipe/containers.py
Outdated
@@ -301,6 +301,10 @@ class CameraHillasParametersContainer(BaseHillasParametersContainer): | |||
width = Field(nan * u.m, "standard spread along the minor-axis", unit=u.m) | |||
width_uncertainty = Field(nan * u.m, "uncertainty of width", unit=u.m) | |||
psi = Field(nan * u.deg, "rotation angle of ellipse", unit=u.deg) | |||
psi_uncertainty = Field(nan * u.deg, "uncertainty of psi", unit=u.deg) | |||
b_uncertainty = Field( |
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.
This needs a better name. Also, for what is this additional uncertainty needed?
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.
The axis of the image is modeled with the function y = ax + b. After rotating the image (so the axis is horizontal), the uncertainty of a = psi uncertainty. However, the axis uncertainty along the transverse direction should be the combination of the psi uncertainty and the b uncertainty, i.e. transverse uncertainty sigma_t = pow( pow(dsigma_psi,2) + pow(sigma_b,2) , 0.5), where d is the longitudinal coordinate of the test point.
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.
How about "transverse_cog_uncertainty" ?
@ruoyushang to get the CI to work, you must add a file called |
@kosack Thank you for the information! I just added the file with a description. However, I also see this error when I pushed the commit: |
I guess you haven't set up the pre-commit hooks properly, typically they would catch that type of errors lint error before you even push the commit. As for critical, well... It's very easy to fix so there's no reason to skip that check. |
@Tobychev Thank you for the information. Can you please show me how to find this bug? How do I use this pre-commit hook? I did pre-commit install following this link (https://ctapipe.readthedocs.io/en/latest/developer-guide/getting-started.html), but I don't know what to do next. |
You can run it manually now to fix the past commits:
It will make changes, add and commit them. Some checks might also require manual changes, edit the files accordingly and then also add and commit. |
Analysis Details0 IssuesCoverage and DuplicationsProject ID: cta-observatory_ctapipe_AY52EYhuvuGcMFidNyUs |
Hi @maxnoe , thank you for the feedback. I was able to fix the error. Now there is one remaining failed check that complains about duplicated lines: 6.56% Duplicated Lines (%) on New Code (is greater than 3.00%) Is this something that requires fixing, or we can proceed to merging? |
@@ -301,6 +301,10 @@ class CameraHillasParametersContainer(BaseHillasParametersContainer): | |||
width = Field(nan * u.m, "standard spread along the minor-axis", unit=u.m) | |||
width_uncertainty = Field(nan * u.m, "uncertainty of width", unit=u.m) | |||
psi = Field(nan * u.deg, "rotation angle of ellipse", unit=u.deg) | |||
psi_uncertainty = Field(nan * u.deg, "uncertainty of psi", unit=u.deg) | |||
transverse_cog_uncertainty = Field( | |||
nan * u.m, "rotated centroid y coordinate uncertainty", unit=u.m |
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 have a hard time understanding how "rotated centroid y coordinate uncertainty" and "uncertainty on the center of gravity along the transverse axis of the image" can mean the same thing, and I think the definition you give in the changelog is much clearer.
@ruoyushang Looking at what Sonarqube complains about, its actually an old sin that your four additional lines caused to be judged anew by the CI. It also looks a bit annoying to fix elegantly because the two different return Containers have different argument names. So you could probably resolve the issue by stuffing all the arguments into a list and feed it into |
@Tobychev We can just ignore this duplication for now, we anyway want to remove the |
More critical here is to do some performance testing: how do these new computations affect the processing time? |
Hi @Tobychev @maxnoe , thank you for the feedback! Do you have a suggestion on how the performance test should be done? Can I use time.perf_counter() and compare the difference in processing time? |
I calculated the time needed for the uncertainty estimation with the following code: tic_psi_unc = time.perf_counter() Here are several images and the time spent for the uncertainty calculation: image size = 551.4, time spent: 0.000064 sec |
Adding estimation of image psi uncertainty and uncertainty of image cog along the rotated y-axis in hillas.py.
Also adding a test script to show the validation of psi uncertainty estimation using toy models.