From 4b88995f8b5b365f670349a5bd328aa8b6c1ede7 Mon Sep 17 00:00:00 2001
From: Kipp Cannon <kipp.cannon@ligo.org>
Date: Thu, 14 Feb 2019 16:59:04 +0900
Subject: [PATCH] streamthinca:  use value_slice_to_index()

- new segmentlist method implementing solution to problem that exists in several codes.  switching to it addresses a FIXME.
---
 gstlal-inspiral/python/streamthinca.py | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/gstlal-inspiral/python/streamthinca.py b/gstlal-inspiral/python/streamthinca.py
index c49771aa25..a3bb34c6e0 100644
--- a/gstlal-inspiral/python/streamthinca.py
+++ b/gstlal-inspiral/python/streamthinca.py
@@ -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
-- 
GitLab