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
Allows DataStoreMaker to be used with IRFs not following CALDB structure #3846
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Conclusion from the dev meeting:
|
I modified the |
@QRemy Maybe still support the case where |
As the |
No, I meant something along the lines of: def from_events_files(event_paths, irf_paths):
"""..."""
if len(irf_paths) == 1:
irf_paths = [irf_paths] * len(event_paths) |
Codecov Report
@@ Coverage Diff @@
## master #3846 +/- ##
==========================================
+ Coverage 93.77% 93.81% +0.03%
==========================================
Files 162 162
Lines 20044 20060 +16
==========================================
+ Hits 18797 18819 +22
+ Misses 1247 1241 -6
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
601f255
to
c3b34e0
Compare
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.
Thanks @QRemy .
I have left some inline comments in the notebook.
@fabiopintore is this new behavior fine?
@@ -747,8 +746,11 @@ | |||
"outputs": [], | |||
"source": [ | |||
"%%time\n", | |||
"n_obs = len(tstarts)\n", | |||
"irf_paths = [Path(irf_filename)] * n_obs\n", |
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.
Is it useful here? It is only when reading that you need the path to the irf now, no?
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.
In general observations can have different irf files so the list of irfs_path have to be defined before the loop. I wanted to stress that in the notebook, even if it is not necessary for this use case (but we could use 2 different zenith angles for example).
"paths = list(path.rglob(\"events*.fits\"))\n", | ||
"data_store = DataStore.from_events_files(paths)\n", | ||
"events_paths = list(path.rglob(\"events*.fits\"))\n", | ||
"data_store = DataStore.from_events_files(events_paths, irf_paths)\n", |
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 is probably where you could define the list of irf_path no?
It seems OK to me and no further comments from my side. Thanks @QRemy to have taken care of this! |
59a5717
to
81f6a80
Compare
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.
Thanks @QRemy . This looks good to me.
DataStore.from_events_files is used to create HDU and observation index tables from the EVENTS header. But this works only for IRFs following the CALDB structure, and the events file header have to contains the TELESCOP, CALDB, and IRF keywords (not part of GADF).
This PR improve the generation of the irf filename from the CALDB infos, and alternatively allow to read it directly from an extra keyword IRF_FILE in the events metadata.
Now, the events_sampling notebook show how to add this keyword, so the index files generated are not broken.