-
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
Overburden-to-height conversion functions #2422
Overburden-to-height conversion functions #2422
Conversation
I wanted to make a simple plot of height vs. grammage using this function to check for the edge behavior for the cubic interpolation, but it flat out failed: from ctapipe.io import EventSource
import numpy as np
import astropy.units as u
source = EventSource("dataset://gamma_prod5.simtel.zst")
grammage = np.linspace(0, 1200, 100) * u.g/u.cm**2
source.atmosphere_density_profile.height_from_overburden(grammage)
|
The error is mostly misleading, because it reports the transformed by log-values, so the user cannot really tell what is wrong easily |
Please also rebase vs. current main to get the docs build working |
c0c7f29
to
2b6059c
Compare
I played around a bit locally and wanted to open a PR against your branch but accidentally pushed here directly. Could you have a look at 51dbae7 and see if this ok with you? If not I'll revert sorry |
The commit looks alright. Should there be a test similar to the one you added for the other profiles as well, i.e. should we explicitly guard against inputing a negative height to the exponential model or is this a potentially relevant case? |
@gschwefer Yes, I think the three classes should behave the same regarding invalid inputs, otherwise they are not interchangeable |
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.
Looks good, but we're still missing the inverse of AtmosphereProfile.line_of_site_integral
where the zenith angle is taken into account (i.e. profile.distance_from_slant_depth(slant_depth, zenith_angle=60*u.deg)
or whatever we want to call it), which is what you actually need for ImPACT, right?
ImPACT reconstructs slant depth, but what that is converted to as an output is up to whatever we decide it should. Currently, we would need a function that is |
Another question about the functions currently there: Is the line_of_sight_integral function really correct? Because the distance you put into it is a distance from the observer, but the integral functions uses heights a.s.l. |
It seems you ran an older version of black that formats the powers slightly differently. Running black via pre-commit should use the same version as in the CI, e.g. copy the exact command of the CI:
|
Yep thanks for the tip, I committed from a different ctapipe installation than normal where the pre-commit hooks are not setup properly |
Hi @gschwefer Could you fix the conflicts? |
I'll have a look later today |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2422 +/- ##
==========================================
+ Coverage 92.59% 92.66% +0.06%
==========================================
Files 232 232
Lines 20034 20220 +186
==========================================
+ Hits 18551 18736 +185
- Misses 1483 1484 +1 ☔ View full report in Codecov by Sentry. |
docs build failure is unrelated, I am investigating |
5b95eb2
to
5869a42
Compare
@maxnoe Looks like this tests fail is a github issue to me |
Yes, seems to be something wrong / changed with the mac os base images, will check |
I am a bit confused: https://github.com/actions/runner-images?tab=readme-ov-file#available-images Says the Maybe the rollout is not yet complete? And the failed run was running on arm / macos 14. Edit: no, both were running on macos 12 |
This comment has been minimized.
This comment has been minimized.
Ok, was flaky, the latest run passed |
Sonarqube is complaining about duplicated code in the tests, a large chunk is exactly equal:
Could be a module constant or a fixture |
I'll have a look |
Analysis Details2 IssuesCoverage and DuplicationsProject ID: cta-observatory_ctapipe_AY52EYhuvuGcMFidNyUs |
Implements the overburden to height conversion functions in the atmosphere module