From 2ca43a50304183edb88d44a02b5de1c4df2a117d Mon Sep 17 00:00:00 2001
From: Duncan Meacher <duncan.meacher@ligo.org>
Date: Fri, 7 Dec 2018 14:41:23 -0800
Subject: [PATCH] gstlal_inspiral_pipe: Added template bank id check

---
 gstlal-inspiral/bin/gstlal_inspiral_pipe | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gstlal-inspiral/bin/gstlal_inspiral_pipe b/gstlal-inspiral/bin/gstlal_inspiral_pipe
index a09bd5a6ae..51c338d121 100755
--- a/gstlal-inspiral/bin/gstlal_inspiral_pipe
+++ b/gstlal-inspiral/bin/gstlal_inspiral_pipe
@@ -1082,6 +1082,11 @@ def parse_command_line():
 
 	options, filenames = parser.parse_args()
 
+	if options.template_bank:
+		bank_xmldoc = ligolw_utils.load_filename(options.template_bank, verbose = options.verbose, contenthandler = LIGOLWContentHandler)
+		sngl_inspiral_table = lsctables.SnglInspiralTable.get_table(bank_xmldoc)
+		assert len(sngl_inspiral_table) == len(set([r.template_id for r in sngl_inspiral_table])), "Template bank ids are not unique"
+
 	if options.mass_model not in ("ligo", "file"):
 		raise ValueError("--mass-model must be 'ligo' or 'file'")
 	if options.mass_model == "file" and not options.mass_model_file:
-- 
GitLab