-
Notifications
You must be signed in to change notification settings - Fork 355
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
Final version of pycbc_pygrb_plot_chisq_veto
and pycbc_pygrb_plot_coh_ifosnr
#4950
Conversation
…e apply_vetoes_to_found_injs for the time being)
…e apply_vetoes_to_found_injs for the time being)
# Exit gracefully if the requested IFO is not available | ||
if ifo and ifo not in ifos: | ||
err_msg = "The IFO selected with --ifo is unavailable in the data." | ||
raise RuntimeError(err_msg) |
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 in ppu.extract_ifos
# Extract IFOs | ||
ifos = ppu.extract_ifos(trig_file) | ||
|
||
# Generate time-slides dictionary | ||
slide_dict = ppu.load_time_slides(trig_file) | ||
|
||
# Generate segments dictionary | ||
segment_dict = ppu.load_segment_dict(trig_file) | ||
|
||
# Construct trials removing vetoed times | ||
trial_dict, total_trials = ppu.construct_trials( | ||
opts.seg_files, | ||
segment_dict, | ||
ifos, | ||
slide_dict, | ||
opts.veto_file | ||
) | ||
|
||
# Load trigger and injections data: ensure that newtwork power chi-square plots | ||
# show all the data to see the impact of the reweighted SNR cut, otherwise remove | ||
# points with reweighted SNR below threshold | ||
rw_snr_threshold = None if veto_type == 'network' else opts.newsnr_threshold | ||
trig_data = ppu.load_data(trig_file, ifos, data_tag='trigs', | ||
rw_snr_threshold=rw_snr_threshold, | ||
slide_id=opts.slide_id) | ||
inj_data = ppu.load_data(found_missed_file, ifos, data_tag='injs', | ||
rw_snr_threshold=rw_snr_threshold, | ||
slide_id=0) |
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 equivalent to what is now in pycbc_pygrb_plot_null_stats
.
# Extract needed trigger properties and store them as dictionaries | ||
# Based on trial_dict: if vetoes were applied, trig_* are the veto survivors | ||
found_trigs_slides = ppu.extract_trig_properties( | ||
trial_dict, | ||
trig_data, | ||
slide_dict, | ||
segment_dict, | ||
keys | ||
) | ||
found_trigs = {} | ||
for key in keys: | ||
found_trigs[key] = numpy.concatenate( | ||
[found_trigs_slides[key][slide_id][:] for slide_id in slide_dict] | ||
) | ||
|
||
# Gather injections found surviving vetoes | ||
found_injs, *_ = ppu.apply_vetoes_to_found_injs( | ||
opts.found_missed_file, | ||
inj_data, | ||
ifos, | ||
veto_file=opts.veto_file, | ||
keys=keys | ||
) |
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 equivalent to what is now in pycbc_pygrb_plot_null_stats.
# Extract IFOs | ||
ifos = ppu.extract_ifos(trig_file) | ||
|
||
# Generate time-slides dictionary | ||
slide_dict = ppu.load_time_slides(trig_file) | ||
|
||
# Generate segments dictionary | ||
segment_dict = ppu.load_segment_dict(trig_file) | ||
|
||
# Construct trials removing vetoed times | ||
trial_dict, total_trials = ppu.construct_trials( | ||
opts.seg_files, | ||
segment_dict, | ||
ifos, | ||
slide_dict, | ||
opts.veto_file |
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 equivalent to what is now in pycbc_pygrb_plot_null_stats
.
# Load triggers/injections (apply reweighted SNR cut, not vetoes) | ||
trig_data = ppu.load_data(trig_file, ifos, data_tag='trigs', | ||
rw_snr_threshold=opts.newsnr_threshold, | ||
slide_id=opts.slide_id) | ||
inj_data = ppu.load_data(found_missed_file, ifos, data_tag='injs', | ||
rw_snr_threshold=opts.newsnr_threshold, | ||
slide_id=0) |
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 equivalent to what is now in pycbc_pygrb_plot_null_stats
.
found_trigs_slides = ppu.extract_trig_properties( | ||
trial_dict, | ||
trig_data, | ||
slide_dict, | ||
segment_dict, | ||
keys | ||
) |
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 equivalent to what is now in pycbc_pygrb_plot_null_stats
.
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 agree with @titodalcanton on the chi square == 0
. Also minor comment, would it be possible to rename the variable senstvty
and ifo_senstvty
to sensitivity
in pycbc_pygrb_plot_coh_ifosnr
?
Co-authored-by: Tito Dal Canton <[email protected]>
Co-authored-by: Tito Dal Canton <[email protected]>
Co-authored-by: Tito Dal Canton <[email protected]>
Co-authored-by: Tito Dal Canton <[email protected]>
Co-authored-by: Tito Dal Canton <[email protected]>
Co-authored-by: Tito Dal Canton <[email protected]>
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.
No further comments from me.
This PR is the fifth in the series started in PR #4929. Much like PR #4947 did with
pycbc_pygrb_plot_null_stats
, this PR provides a version ofpycbc_pygrb_plot_chisq_veto
andpycbc_pygrb_plot_coh_ifosnr
that uses veto and segments files, as well as the utilities introduced recently to streamline the PyGRB results scripts.Standard information about the request (and the following ones that will be linked to this)
This is a: a new feature enabling veto definer file usage in PyGRB. Utilities and scripts in results production are being streamlined along the way.
This change affects: PyGRB
This change changes: result presentation / plotting and scientific output.
Should this change break the standard automated test running
--help
for PyGRB plotting scripts, I will add some workarounds to avoid this. If needed, these will likely be empty functions: the plotting scripts will be progressively renovated in the whole series of PRs.Motivation
Now that the workflow generator passes the veto definer file to the jobs where needed, its usage in the PyGRB results scripts is possible.
Testing performed
The totality of the changes that will be broken down in multiple PRs was tested on GRB 170817A data by producing a full results webpage (see here).