-
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
Ranking statistic for live singles #4689
Ranking statistic for live singles #4689
Conversation
…te with case where no triggers are found
c1dd2ee
to
4d11273
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.
Minor explanation comments
@@ -6,7 +6,7 @@ | |||
import h5py | |||
import numpy as np | |||
|
|||
f = h5py.File('single_trigger_fits.hdf','w') | |||
f = h5py.File('single_significance_fits.hdf','w') |
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.
Renaming to clarify the two types of single fits
@@ -682,7 +682,7 @@ def rank_stat_single(self, single_info, | |||
numpy.ndarray | |||
The array of single detector statistics | |||
""" | |||
return single_info[1] | |||
return single_info[1]['snglstat'] |
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 allows the phasetd
rank_stat_single
to actually work!
BTW - I requested reviews from both Arthur and Tito as I am aware that Arthur has the expertise in adding the statistic objects to Live, and Tito understands more of the significance fitting, so I don't expect you both to be able to review all of it |
@@ -158,43 +198,62 @@ def check(self, trigs, data_reader): | |||
# Apply cuts to trigs before clustering | |||
# Cut on snr so that triggers which could not reach newsnr | |||
# threshold do not have newsnr calculated | |||
if 'psd_var_val' in trigs: |
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 here for the psdvar conversions
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.
Just a single question from me but happy to approve. Glad to see the fits being included in the live example too!
pycbc/events/stat.py
Outdated
@@ -711,8 +711,8 @@ def coinc_lim_for_thresh(self, sngls_list, thresh, limifo, | |||
if not self.has_hist: | |||
self.get_hist() | |||
|
|||
lim_stat = [b['snglstat'] for a, b in sngls_list if a == limifo][0] | |||
s1 = thresh ** 2. - lim_stat ** 2. | |||
fixed_stat = [b['snglstat'] for a, b in sngls_list if a != limifo][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.
Is this a change in logic (going from == to !=) or was this not working properly before?
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 wasn't working properly before - the statistic from the limifo was being used instead of the fixed IFO network
Looking again, I don't think this will actually work, so I will check it again
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.
It was broken, just in a different way.
The basic problem was this - the sngls_list
passed to coinc_lim_for_thresh
did not contain the limifo
singles (here). As a result, the list comprehension was empty, and the [0] at the end of the line broke.
The problem with my fix was that by using only the first entry, this works for 2-ifo, but not for 3-ifo (but doesn't actually error).
As the list of sngls passed to coinc_lim_for_thresh doesn't contain the limifo, we can remove this check, but it should be a sum of squares rather than grabbing the zeroth entry.
Note: new commits do not affect the part of the code which Arthur has reviewed |
poke @titodalcanton to look at the supervision scripts here |
pycbc/events/single.py
Outdated
(trig_chisq < | ||
self.thresholds['reduced_chisq']) & \ | ||
(trigs['snr'] > | ||
(trig_snr > |
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 seems to effectively change the meaning of --reduced-chisq-threshold
and --newsnr-threshold
in case the PSD var statistic is used, i.e. "reduced chisq" and "newsnr" will no longer mean what people historically think they mean. Should we rename the two options then?
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 I'd like to change these to use the template-cuts and trigger-cuts module eventually, but for now I have updated single-newsnr-threshold to be call single-ranking-threshold, and and added a note to the help on the chisq threshold
Co-authored-by: Tito Dal Canton <tito.dalcanton@ijclab.in2p3.fr>
Co-authored-by: Tito Dal Canton <tito.dalcanton@ijclab.in2p3.fr>
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 we can merge and start proper tests on this now, provided the CI passes.
* Allow the live single trigger fits to use ranking statistic rather than sngl-ranking * inbin is no longer all the events above threshold, plotting to indicate with case where no triggers are found * deal better with cases where there are no triggers * Use ranking statistic for single-detector events * Fix some errors * fix some statistics so they can produce single-detector events * Some codeclimate suggestions * get fit coeff files into CI, set a maximum IFAR for singles * alter the CI example run * Codeclimate suggestions * Line too long * minor tweaks * Used shared code * Fix broken fixing * missed that this needs the module * typo * calculate plotmax earlier and use it to decide the histogram bins * Update bin/live/pycbc_live_plot_single_significance_fits Co-authored-by: Tito Dal Canton <tito.dalcanton@ijclab.in2p3.fr> * TDC comments * Update threshold naming and description * update argument in example * Please do not look at the previous commit and see how much of an idiot I am * Update bin/live/pycbc_live_combine_single_significance_fits Co-authored-by: Tito Dal Canton <tito.dalcanton@ijclab.in2p3.fr> --------- Co-authored-by: Tito Dal Canton <tito.dalcanton@ijclab.in2p3.fr>
This PR does a couple of things: