Skip to content

Commit

Permalink
Make things qork in the case that no foreground is present (#4908)
Browse files Browse the repository at this point in the history
  • Loading branch information
GarethCabournDavies authored Oct 23, 2024
1 parent e89f1be commit 941b15f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bin/all_sky_search/pycbc_coinc_statmap
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,9 @@ if fore_locs.sum() > 0:
f['foreground/ifar_exc'] = conv.sec_to_year(ifar_exc)
f['foreground/fap_exc'] = fap_exc
else:
f['foreground/ifar'] = numpy.array([])
f['foreground/ifar'] = ifar = numpy.array([])
f['foreground/fap'] = numpy.array([])
f['foreground/ifar_exc'] = numpy.array([])
f['foreground/ifar_exc'] = ifar_exc = numpy.array([])
f['foreground/fap_exc'] = numpy.array([])

if 'name' in all_trigs.attrs:
Expand Down Expand Up @@ -331,6 +331,10 @@ else :
# will happen when ifar_foreground has no elements greater than
# the background time.

# This is a workaround for the case that we have no foreground, so that the
# while loop comparison doesnt fail straight away
ifar_foreground = numpy.append(ifar_foreground, 0)

while numpy.any(ifar_foreground >= background_time):
# If the user wants to stop doing hierarchical removals after a set
# number of iterations then break when that happens.
Expand Down

0 comments on commit 941b15f

Please sign in to comment.