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

Starting expansion of PyGRB post-processing workflow generator #4891

Merged
merged 3 commits into from
Sep 26, 2024

Conversation

pannarale
Copy link
Contributor

@pannarale pannarale commented Sep 24, 2024

Adding two utils functions within pycbc_pygrb_pp_workflow and (re)designing the opening page for a PyGRB results webpage.

Motivation

This PR continues work started with #4872 to breakdown the workflow changes that produce a complete PyGRB results page. It is the first of a series of PRs that affects pycbc_pygrb_pp_workflow.

Standard information about the request

This is a: the beginning of work to allow an end-to-end PyGRB run from master, with all results displayed in the final webpage.

This change affects: PyGRB

This change changes: result presentation / plotting.

Contents

The two new utility functions are:

  1. fish_label_in_filelist – This is needed to retrive a specific injections results File, given the injection set label. E.g., when a plot for "NSBH" injections is being produce, the "NSBH" injections results File needs to be pinpointed among all injections results files in a FileList. The function returns the File, but we could think of returning a dictionary {injection set label: corresponding File} so that we filter the FileList once and for all rather than anytime results for and injections set are needed. Or something completely different: I am happy to hear suggestions from the PR reviewer.
  2. display_seg_plot – The PyGRB segments plot is produced in preprocessing. I would like the results webpage to display this in the opening page, so this function retrieves it and add metadata to it (prior to sticking it on the opening page). The metadata is added here because the current preprocessing code does not use save_fig_with_metadata for this plot, nor a stand alone executable to produce it. Since PyGRB will have to undergo a pretty large review, I am currently staying away from touching the old and already reviewed preprocessing material. In the longer term, the clean solution I have in mind is to add the capability to display the PyGRB offsource and external trigger time on top of the standard all-sky segments plot; then it would be a matter of retrieving that File without the need for display_seg_plot

The rest of the changes simply organise the layout of the landing page.

Testing performed

The complete set of changes will produce the end result linked above, but the single PRs will enable only part of it ad do not have stand alone examples/tests.

Additional notes

The PRs that will come up after this one will "just" add tabs and sections to the results webpage and fill them up. These are the only 2 functions that were added.

  • The author of this pull request confirms they will adhere to the code of conduct

@pannarale pannarale added the PyGRB PyGRB development label Sep 24, 2024
@pannarale pannarale self-assigned this Sep 24, 2024
Copy link
Contributor

@spxiwh spxiwh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main question is about the File in FileList function. I would like to understand what this is testing and would like it moved to a method of a FileList class (unless this is doing something very specific/odd or the functionality already exists).

@@ -43,6 +43,48 @@ __date__ = pycbc.version.date
__program__ = "pycbc_pygrb_pp_workflow"


# Function used to retrive a File instance from a FileList based on an
# injection set label
def fish_label_in_filelist(label, filelist):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function doesn't belong here. It should be a method in the FileList class (in core.py). BUT first, does the functionality desired already exist?

Are you basically asking here if label is a tag in the file? (Note that using the file name is dangerous and should not be done, checking the attributes is better). If so, this exists:

https://github.com/gwastro/pycbc/blob/master/pycbc/workflow/core.py#L1549

if not, can you elaborate on what label is (or what the file attributes are, to figure out how it decides this).

bin/pygrb/pycbc_pygrb_pp_workflow Show resolved Hide resolved
bin/pygrb/pycbc_pygrb_pp_workflow Show resolved Hide resolved
@pannarale
Copy link
Contributor Author

I followed the suggestions above, adopting the solutions discussed privately. The webpage and all its contents were successfully regenerated here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PyGRB PyGRB development
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants