Skip to content

Commit

Permalink
fixes to the some broken statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
GarethCabournDavies committed Jan 24, 2024
1 parent fe19555 commit 596ca46
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bin/all_sky_search/pycbc_sngls_findtrigs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ for tnum in template_ids:
sds = rank_method.single(trigs)[trigger_keep_ids]
stat_t = rank_method.rank_stat_single((ifo, sds),
**extra_kwargs)
trigger_times = sds['end_time']
trigger_times = trigs['end_time'][:][trigger_keep_ids]
if args.cluster_window:
cid = coinc.cluster_over_time(stat_t, trigger_times,
args.cluster_window)
Expand Down
17 changes: 9 additions & 8 deletions pycbc/events/stat.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,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']

def rank_stat_coinc(self, sngls_list, slide, step, to_shift,
**kwargs): # pylint:disable=unused-argument
Expand Down Expand Up @@ -709,8 +709,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]
s1 = thresh ** 2. - fixed_stat ** 2.
# Assume best case scenario and use maximum signal rate
s1 -= 2. * self.hist_max
s1[s1 < 0] = 0
Expand Down Expand Up @@ -1006,6 +1006,7 @@ def __init__(self, sngl_ranking, files=None, ifos=None, **kwargs):
# for low-mass templates the exponential slope alpha \approx 6
self.alpharef = 6.
self.single_increasing = True
self.single_dtype = numpy.float32

def use_alphamax(self):
"""
Expand Down Expand Up @@ -1056,9 +1057,9 @@ def rank_stat_single(self, single_info,
The array of single detector statistics
"""
if self.single_increasing:
sngl_multiifo = single_info[1]['snglstat']
sngl_multiifo = single_info[1]
else:
sngl_multiifo = -1. * single_info[1]['snglstat']
sngl_multiifo = -1. * single_info[1]
return sngl_multiifo

def rank_stat_coinc(self, s, slide, step, to_shift,
Expand Down Expand Up @@ -2182,11 +2183,11 @@ def coinc_lim_for_thresh(self, s, thresh, limifo, **kwargs):
'quadsum': QuadratureSumStatistic,
'single_ranking_only': QuadratureSumStatistic,
'phasetd': PhaseTDStatistic,
'exp_fit_stat': ExpFitStatistic,
#'exp_fit_stat': ExpFitStatistic,
'exp_fit_csnr': ExpFitCombinedSNR,
'phasetd_exp_fit_stat': PhaseTDExpFitStatistic,
#'phasetd_exp_fit_stat': PhaseTDExpFitStatistic,
'dq_phasetd_exp_fit_fgbg_norm': DQExpFitFgBgNormStatistic,
'exp_fit_bg_rate': ExpFitBgRateStatistic,
#'exp_fit_bg_rate': ExpFitBgRateStatistic,
'phasetd_exp_fit_fgbg_norm': ExpFitFgBgNormStatistic,
'phasetd_exp_fit_fgbg_bbh_norm': ExpFitFgBgNormBBHStatistic,
'phasetd_exp_fit_fgbg_kde': ExpFitFgBgKDEStatistic,
Expand Down

0 comments on commit 596ca46

Please sign in to comment.