Skip to content

Commit

Permalink
stat: combine background rate with p/t/a for HL
Browse files Browse the repository at this point in the history
  • Loading branch information
tdent committed Jul 15, 2019
1 parent 92c7845 commit e23ce3b
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions pycbc/events/stat.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def coinc(self, s0, s1, slide, step): # pylint:disable=unused-argument
numpy.ndarray
Array of coincident ranking statistic values
"""
return (s0**2. + s1**2.) ** 0.5
return (s0 ** 2. + s1 ** 2.) ** 0.5

def coinc_multiifo(self, s, slide, step,
**kwargs): # pylint:disable=unused-argument
Expand Down Expand Up @@ -612,8 +612,9 @@ class ExpFitSGFgBgRateStatistic(PhaseTDStatistic, ExpFitSGBgRateStatistic):
def __init__(self, files):
# read in background fit info and store it, also use newsnr_sgveto
ExpFitSGBgRateStatistic.__init__(self, files)
# also use PhaseTD statistic single.dtype
# Use PhaseTD statistic single.dtype
PhaseTDStatistic.__init__(self, files)
self.get_newsnr = ranking.get_newsnr_sgveto

def single(self, trigs):
# single-ifo stat = log of noise rate
Expand All @@ -631,26 +632,23 @@ def coinc_multiifo(self, s, slide,
step, **kwargs): # pylint:disable=unused-argument
sngl_rates = {ifo: sngl_data['snglstat'] for ifo, sngl_data in
s.items()}
ln_noise_rate = coinc_rate.combination_noise_lograte(sngl_rates,
kwargs['time_addition'])
yesprint = False
if len(ln_noise_rate):
yesprint = True
print(ln_noise_rate) # diagnostic for testing
ln_noise_rate = coinc_rate.combination_noise_lograte(
sngl_rates, kwargs['time_addition'])
# logsignalrate function inherited from PhaseTDStatistic
# - for now, only use H-L consistency
ifos = s.keys()
if 'H1' in ifos and 'L1' in ifos:
if yesprint:
print('Applying HL phase/time/amp consistency')
logr_s = self.logsignalrate(s['H1'], s['L1'], slide, step)
if len(logr_s):
logging.info('Applying HL phase/time/amp consistency')
# makeshift factor to compensate HL(V) coincs which are penalized
# on average by p/t/a vs HV, LV which are not
logr_s = logr_s + 4.5
else:
if yesprint:
print('HV or LV coinc, no phase/time-amp/consistency')
logr_s = numpy.zeros_like(s['V1']['snr'])
if len(logr_s):
logging.info('HV or LV coinc, no phase/time-amp/consistency')

if yesprint:
print(logr_s)
loglr = logr_s - ln_noise_rate + self.benchmark_lograte
return loglr

Expand Down

0 comments on commit e23ce3b

Please sign in to comment.