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

streamthinca: use value_slice_to_index()

- new segmentlist method implementing solution to problem that exists in several codes.  switching to it addresses a FIXME.
parent ec8ec872
No related branches found
No related tags found
No related merge requests found
......@@ -201,13 +201,6 @@ class last_coincs(object):
#
def lower_bound_in_seglist(seglist, x):
# FIXME: replace with segmentlist.value_slice_to_index() when we
# can rely on a new-enough ligo.segments
i = max(bisect_left(seglist, x) - 1, 0)
return i + 1 if seglist and seglist[i][1] <= x else i
class backgroundcollector(object):
def __init__(self):
self.zerolag_singles = set()
......@@ -282,7 +275,7 @@ class StreamThinca(object):
# clip the lists to reduce subsequent operation count.
age = float(self.time_slide_graph.age)
snr_segments = segments.segmentlistdict((instrument, ratebinlist[lower_bound_in_seglist(ratebinlist, age):].segmentlist()) for instrument, ratebinlist in rankingstat.denominator.triggerrates.items())
snr_segments = segments.segmentlistdict((instrument, ratebinlist[ratebinlist.value_slice_to_index(slice(age, None))].segmentlist()) for instrument, ratebinlist in rankingstat.denominator.triggerrates.items())
#
# iterate over coincidences
......
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