-
Notifications
You must be signed in to change notification settings - Fork 357
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
Handling empty table in PyGRB #5026
Conversation
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 I have some suggestions that may make this code better.
bin/pygrb/pycbc_pygrb_page_tables
Outdated
loud_on_bestnr_trigs, loud_on_bestnr = \ | ||
(on_trigs['network/event_id'][bestNR_event], | ||
on_trigs_bestnrs[bestNR_event]) |
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 think this assignment is more readable in two lines.
bin/pygrb/pycbc_pygrb_page_tables
Outdated
@@ -646,6 +657,10 @@ if found_missed_file is not None: | |||
len(td)) | |||
td = list(zip(*td)) | |||
|
|||
# Handle the case in which there is no data to be placed in the table | |||
if not td: | |||
td = [[] for i in np.arange(len(th))] |
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.
See comment on similar block above.
bin/pygrb/pycbc_pygrb_page_tables
Outdated
# When len(offsource_trigs) == 0, the loop above leaves td = [] unchanged | ||
# and this case needs to be handled adequately prior to moving on | ||
if not td: | ||
td = [[] for i in np.arange(len(th))] |
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.
See comment on similar block below.
Co-authored-by: Tito Dal Canton <tito@dalcanton.it>
Co-authored-by: Tito Dal Canton <tito@dalcanton.it>
This PR enables the production of tables, within PyGRB, when the table needs to be empty.
Standard information about the request
This is a: new feature
This change affects: PyGRB
This change changes: result presentation
Motivation
The current version of
pycbc_pygrb_page_tables
(designed to handle missed/vetoed injections and loudest events) will not work when there is no injection/trigger to be displayed.Contents
This PR fixes this issue. The script no longer assumes there are injections to be displayed; further, it checks whether there is an onsource trigger to be reported: if there is not, the h5 file will be empty, where as the html file will say "There are no events" in the first column and report "-" in the remaining columns, to leave a human readable message.
Testing performed
The functioning of this can be checked in sections 3.01, 3.03, and 6 of this webpage.
Additional notes
The code to handle the case in which the offsource yields no triggers is along the lines of the one implemented for the injections, but admittedly it is not tested in this run.