Skip to content

Commit

Permalink
Actually purge
Browse files Browse the repository at this point in the history
  • Loading branch information
GarethCabournDavies committed Jul 10, 2023
1 parent 5e0eb76 commit c4bba71
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 45 deletions.
9 changes: 1 addition & 8 deletions bin/all_sky_search/pycbc_add_statmap
Original file line number Diff line number Diff line change
Expand Up @@ -266,19 +266,12 @@ def filter_dataset(h5file, name, idx):
# multiple files
for key in f['foreground'].keys():
if key not in all_ifos:
if f['foreground/%s' % key].size == 0:
# This is an indicator that the column was specifically
# not calculated
logging.info('foreground/%s dataset is being ignored', key)
continue
filter_dataset(f, 'foreground/%s' % key, cidx)
else: # key is an ifo
for k in f['foreground/%s' % key].keys():
filter_dataset(f, 'foreground/{}/{}'.format(key, k), cidx)

fg_ifar_exc_init = f['foreground/ifar_exc'][:]

n_triggers = fg_ifar_exc_init.size
n_triggers = f['foreground/stat'].size

logging.info('Calculating event times to determine which types of coinc '
'are available')
Expand Down
20 changes: 2 additions & 18 deletions bin/all_sky_search/pycbc_coinc_statmap_inj
Original file line number Diff line number Diff line change
Expand Up @@ -82,36 +82,20 @@ f.attrs['background_time'] = background_time
f.attrs['foreground_time'] = coinc_time

if len(zdata) > 0:

_, fnlouder_exc = significance.get_n_louder(
back_stat,
zdata.stat,
dec_fac,
**significance_dict[ifo_key])

ifar_exc = background_time / (fnlouder_exc + 1)
fap_exc = 1 - numpy.exp(- coinc_time / ifar_exc)
f['foreground/ifar_exc'] = conv.sec_to_year(ifar_exc)
f['foreground/fap_exc'] = fap_exc

logging.info('calculating injection backgrounds')
ifotimes = numpy.array([zdata.data['%s/time' % ifo] for ifo in args.ifos])
ftimes = ifotimes.mean(axis=0)
start, end = ftimes - args.veto_window, ftimes + args.veto_window

fnlouder = numpy.zeros(len(ftimes), dtype=numpy.float32)
ifar = numpy.zeros(len(ftimes), dtype=numpy.float32)
fap = numpy.zeros(len(ftimes), dtype=numpy.float32)

# most of the triggers are here so presort to speed up later sorting
bsort = back_stat.argsort()
dec_fac = dec_fac[bsort]
back_stat = back_stat[bsort]

else:
f['foreground/ifar_exc'] = numpy.array([])
f['foreground/fap_exc'] = numpy.array([])

# Indicate that inclusive IFAR is not calculated
f['foreground/ifar'] = numpy.array([])
f['foreground/fap'] = numpy.array([])

logging.info("Done")
19 changes: 0 additions & 19 deletions bin/all_sky_search/pycbc_sngls_statmap_inj
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,6 @@ fore_stat = all_trigs.stat[fore_locs]

significance_dict = significance.digest_significance_options([ifo], args)

# Cumulative array of inclusive background triggers and the number of
# inclusive background triggers louder than each foreground trigger
back_cnum, fnlouder = significance.get_n_louder(
back_stat,
fore_stat,
bkg_dec_facs,
**significance_dict[ifo])

bg_ifar = fg_time / (back_cnum + 1)

# Cumulative array of exclusive background triggers and the number
# of exclusive background triggers louder than each foreground trigger
back_cnum_exc, fnlouder_exc = significance.get_n_louder(
Expand All @@ -129,15 +119,6 @@ back_cnum_exc, fnlouder_exc = significance.get_n_louder(
fg_ifar_exc = fg_time_exc / (fnlouder_exc + 1)
bg_ifar_exc = fg_time_exc / (back_cnum_exc + 1)

# Not sure if these are actually used later as we
# don't do inclusive
f['background/ifar'] = conv.sec_to_year(bg_ifar)
f.attrs['background_time'] = fg_time
f.attrs['foreground_time'] = fg_time
# Indicate not doing inclusive IFAR/FAP
f['foreground/ifar'] = numpy.array([])
f['foreground/fap'] = numpy.array([])

f['background_exc/ifar'] = conv.sec_to_year(bg_ifar_exc)
f.attrs['background_time_exc'] = fg_time_exc
f.attrs['foreground_time_exc'] = fg_time_exc
Expand Down

0 comments on commit c4bba71

Please sign in to comment.