From ff23c5afa3698e4a18f947a4886b6e484df75e74 Mon Sep 17 00:00:00 2001
From: Kipp Cannon <kcannon@cita.utoronto.ca>
Date: Wed, 4 Apr 2018 01:11:36 +0900
Subject: [PATCH] inspiral.py: make trigger histograms optional

- don't put triggers into SNR, \chi^2 histograms if --likelihood-url is not set:  because there's no point, the data is doing to /dev/null.
---
 gstlal-inspiral/python/inspiral.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/gstlal-inspiral/python/inspiral.py b/gstlal-inspiral/python/inspiral.py
index 84ca77deca..51bd46b1f8 100644
--- a/gstlal-inspiral/python/inspiral.py
+++ b/gstlal-inspiral/python/inspiral.py
@@ -831,13 +831,15 @@ class Data(object):
 			# necessary for this test to be super precisely
 			# defined.
 			for event in itertools.chain(self.stream_thinca.add_events(self.coincs_document.xmldoc, self.coincs_document.process_id, events, buf_timestamp, snr_segments, fapfar = self.fapfar), self.stream_thinca.last_coincs.single_sngl_inspirals() if self.stream_thinca.last_coincs else ()):
+				if self.likelihood_url is None:
+					continue
 				assert event.end in one_or_more_instruments, "trigger at time (%s) with no SNR (%s)" % (str(event.end), str(one_or_more_instruments))
 				if event.end in two_or_more_instruments:
 					self.rankingstat.denominator.increment(event)
 			self.coincs_document.commit()
 
 			# update zero-lag bin counts in rankingstat.
-			if self.stream_thinca.last_coincs:
+			if self.stream_thinca.last_coincs and self.likelihood_url is not None:
 				for coinc_event_id, coinc_event in self.stream_thinca.last_coincs.coinc_event_index.items():
 					if coinc_event.time_slide_id in self.stream_thinca.last_coincs.zero_lag_time_slide_ids:
 						for event in self.stream_thinca.last_coincs.sngl_inspirals(coinc_event_id):
@@ -935,13 +937,15 @@ class Data(object):
 
 		ratebinlists = self.rankingstat.denominator.triggerrates.values()
 		for event in self.stream_thinca.flush(self.coincs_document.xmldoc, self.coincs_document.process_id, snr_segments, fapfar = self.fapfar):
+			if self.likelihood_url is None:
+				continue
 			assert event.end in one_or_more_instruments, "trigger at time (%s) with no SNR (%s)" % (str(event.end), str(one_or_more_instruments))
 			if event.end in two_or_more_instruments:
 				self.rankingstat.denominator.increment(event)
 		self.coincs_document.commit()
 
 		# update zero-lag bin counts in rankingstat.
-		if self.stream_thinca.last_coincs:
+		if self.stream_thinca.last_coincs and self.likelihood_url is not None:
 			for coinc_event_id, coinc_event in self.stream_thinca.last_coincs.coinc_event_index.items():
 				if coinc_event.time_slide_id in self.stream_thinca.last_coincs.zero_lag_time_slide_ids:
 					for event in self.stream_thinca.last_coincs.sngl_inspirals(coinc_event_id):
-- 
GitLab