Skip to content
Snippets Groups Projects
Commit 278924b4 authored by Kipp Cannon's avatar Kipp Cannon
Browse files

FAPFAR: fix off-by-one-bin bug

- in mapping ln L to false-alarm rates
- because we are interested in counts *above* thresholds, not below, the count in a bin should be associated with the lower boundary of the bin, not the upper boundary
parent 474e3aaa
No related branches found
No related tags found
No related merge requests found
......@@ -635,7 +635,7 @@ class FAPFAR(object):
# get noise model ranking stat values and event counts from
# bins
threshold_index = rankingstatpdf.noise_lr_lnpdf.bins[0][rate_normalization_lr_threshold]
ranks = rankingstatpdf.noise_lr_lnpdf.bins[0].upper()[threshold_index:]
ranks = rankingstatpdf.noise_lr_lnpdf.bins[0].lower()[threshold_index:]
counts = rankingstatpdf.noise_lr_lnpdf.array[threshold_index:]
assert not numpy.isnan(counts).any(), "background log likelihood ratio rates contain NaNs"
assert (counts >= 0.).all(), "background log likelihood ratio rates contain negative values"
......@@ -653,11 +653,6 @@ class FAPFAR(object):
# equal the actual observed number of candidates.
ccdf = gstlalstats.poisson_p_not_0(ccdf)
# interpolator won't accept infinite co-ordinates so need
# to remove the last bin
ranks = ranks[:-1]
ccdf = ccdf[:-1]
# safety checks
assert not numpy.isnan(ranks).any(), "log likelihood ratio co-ordinates contain NaNs"
assert not numpy.isinf(ranks).any(), "log likelihood ratio co-ordinates are not all finite"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment