Skip to content
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

Rewrite abscal.match_times() to be much faster when dealing with very long lists of modelfiles #982

Merged
merged 5 commits into from
Jan 23, 2025

Conversation

jsdillon
Copy link
Member

Between lustre's general slowness and the huge number of abscal model files for validation (>8000), it was taking 10s of minutes to find the data's matching model files in LST for abscal.

This cuts it down to a few seconds by performing a binary search and only actually reading O(logN) files' metadata.

@jsdillon
Copy link
Member Author

jsdillon commented Dec 25, 2024

Errors appear to be related to the pending herasim PR: HERA-Team/hera_sim#332

@steven-murray
Copy link
Contributor

@jsdillon I think it might be useful to try to merge the capabilities of this function with the one I wrote for LST-binning:

def match_files_to_lst_bins(
.

Both of them essentially match times with a binary search. The one I wrote also offers the capability of reading the times from the filenames instead of reading the data from the HDF5 file itself (but doesn't require this to run), as well as taking advantage of the fact that almost always, the list of "model files" are separated by a constant amount of time, so a pretty good guess can be made after reading the first file as to which to file to jump to.

Copy link

codecov bot commented Jan 16, 2025

Codecov Report

Attention: Patch coverage is 97.91667% with 1 line in your changes missing coverage. Please review.

Project coverage is 97.20%. Comparing base (c3f0e97) to head (13744fc).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
hera_cal/abscal.py 97.87% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #982   +/-   ##
=======================================
  Coverage   97.20%   97.20%           
=======================================
  Files          31       31           
  Lines       11161    11198   +37     
=======================================
+ Hits        10849    10885   +36     
- Misses        312      313    +1     
Flag Coverage Δ
unittests 97.20% <97.91%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@steven-murray
Copy link
Contributor

I found a small bug in the function and fixed it, but would love to get your take on it, @jsdillon. It was breaking the Validation runs.

While looking at this, I realized that my function for LST binning does do roughly the same thing, but it is sufficiently different such that it's difficult to merge them (it operates on JDs instead of LSTs and directly uses the fact that the files are UVH5 files).

@jsdillon
Copy link
Member Author

@steven-murray if you think this is ready, let's get it merged in

@steven-murray
Copy link
Contributor

@jsdillon it would be good to have a test that would have failed without the fix.

@jsdillon
Copy link
Member Author

@steven-murray I've added some tests that cover that line

@steven-murray steven-murray merged commit 0d72e19 into main Jan 23, 2025
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants