-
Notifications
You must be signed in to change notification settings - Fork 22
MNT: Update HIT L1b livetime calculation #2424
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
base: dev
Are you sure you want to change the base?
MNT: Update HIT L1b livetime calculation #2424
Conversation
The livetime calculation should follow a 3-segment polynomial which was updated in the algorithm document.
|
@gmitch3088 there are failures in the validation data now. Do you have new validation data you are expecting with this update, or should it match the previous validation data for count rates? With this update the count rate is ~100x higher than it was before. |
| livetime = l1a_counts_dataset["livetime_counter"] | ||
| livetime_fraction = xr.zeros_like(livetime, dtype=np.float32) | ||
|
|
||
| # Equation 8 in section 6.2 of the algorithm document | ||
| livetime1 = livetime <= 4101 | ||
| livetime2 = (livetime > 4101) & (livetime <= 16000) | ||
| livetime3 = livetime > 16000 | ||
| livetime_fraction[livetime1] = livetime[livetime1] * 3.41e-5 + 0.14 | ||
| livetime_fraction[livetime2] = livetime[livetime2] * 6.827e-5 | ||
| livetime_fraction[livetime3] = livetime[livetime3] * 1.04e-9 | ||
|
|
||
| livetime = livetime_fraction.rename("livetime") |
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.
Nice implementation of the different calculations using boolean masks. Putting this in a function would make it easier to write a unit test for it
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 looks to me to be in the right place, but @vmartinez-cu can confirm.
|
There are some tests that still use the old calculation. It would be good to update them. Example |
@gmitch3088, for context this validation data is the instrument validation data, not the fake data you produced. This test was written before you began validating against the fake data. It's still a helpful check for changes to the processing code |
Sorry, I missed this. This is expected as the fake validation data assumed that the max was 270 (c.f. the old algorithm). So in the first minute in which the livetime counter was 250, the livetime fraction previously would have been ~0.926 whereas with the new algorithm, it is ~0.149 (similarly, for the second point that has a livetime counter of 188, the previous livetime fraction would be ~0.696 whereas with the new algorithm it is ~0.146). Let me know if you have any questions! |
Change Summary
Overview
The livetime calculation should follow a 3-segment polynomial which was updated in the algorithm document.
closes #2356