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

Add dq fitting to Live supervised fitting script #4866

Merged
merged 21 commits into from
Sep 13, 2024

Conversation

maxtrevor
Copy link
Contributor

This MR completes the statistic upgrade for PyCBC Live by allowing the daily supervised fitting script to produce DQ trigger rate files for use with the DQ reweighting statistic

This is a new feature.

This change primarily affects the live search.

Two files are modified which are used in the offline search; they are bin/all_sky_search/pycbc_bin_templates and bin/plotting/pycbc_plot_dq_flag_likelihood . In both cases, the change should not cause any functional difference.

This changes the scientific output of the live search when the DQ reweighted stat is being used, otherwise it does not make a difference.

This also makes a number of changes to bin/live/pycbc_live_supervise_collated_trigger_fits beyond just adding the dq fitting process. Changes include moving the code used to calculate the original date of replay data into its own function, code style improvements, removing unused imports, changing variable names to be less ambiguous, etc.

Two new scripts are added to the bin/live/ folder, these are used for performing the dq fitting. The first gathers dq statistical information for a day of data, the second combines the information from multiple days an produces a statistic file to be ingested by the search.

After this is merged, we should be ready to create a new release branch for the live analysis.

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

Copy link
Contributor

@GarethCabournDavies GarethCabournDavies left a comment

Choose a reason for hiding this comment

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

This looks good - mainly stylistic/standardisation comments from me with a couple of minor questions

bin/plotting/pycbc_plot_dq_flag_likelihood Outdated Show resolved Hide resolved
bin/plotting/pycbc_plot_dq_flag_likelihood Show resolved Hide resolved
bin/live/pycbc_live_daily_dq_trigger_rates Outdated Show resolved Hide resolved
bin/live/pycbc_live_daily_dq_trigger_rates Outdated Show resolved Hide resolved
bin/live/pycbc_live_supervise_collated_trigger_fits Outdated Show resolved Hide resolved
bin/live/pycbc_live_supervise_collated_trigger_fits Outdated Show resolved Hide resolved
bin/live/pycbc_live_combine_dq_trigger_rates Outdated Show resolved Hide resolved
bin/live/pycbc_live_combine_dq_trigger_rates Show resolved Hide resolved
Comment on lines +126 to +127
ifo_group.create_dataset('observing_livetime', data=livetime)
ifo_group.create_dataset('dq_flag_livetime', data=flagged_time)
Copy link
Contributor

Choose a reason for hiding this comment

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

I've found the issue with using HFile, this line uses hasattr('dtytpe') to check it is is a numpy array, which is needed to allow the fletcher32 keyword to be set.

However numpy number-types have dtype attributes as well. The options are either:

  • change that line to use isinstance(data, np.ndarray) instead [should work]
  • change this line to give dq_flag_livetime as an attribute [will work]
  • Change this line to cast dq_flag_livetime as a numpy array before saving it [I think this will work, and allow this dataset to be checksummed]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think changing that line to use isinstance(data, np.ndarray) is the cleanest fix. It will also prevent this issue from arising again in the future for some other unsuspecting student.

Copy link
Contributor

@GarethCabournDavies GarethCabournDavies left a comment

Choose a reason for hiding this comment

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

All my remaining comments are pedantry/optional, so approving

@maxtrevor maxtrevor merged commit e046c40 into gwastro:master Sep 13, 2024
30 checks passed
@maxtrevor maxtrevor mentioned this pull request Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants