From a1113eb71fda4ce5265892b013584a435ad2dcc5 Mon Sep 17 00:00:00 2001
From: Kipp Cannon <kipp.cannon@ligo.org>
Date: Tue, 20 Feb 2018 06:11:11 +0900
Subject: [PATCH] gstlal_inspiral: add extra config checking

- confirm the channel list matches the instruments in the time slide vectors
- confirm the reference PSDs, if given, match the instruments in the time slides
---
 gstlal-inspiral/bin/gstlal_inspiral | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gstlal-inspiral/bin/gstlal_inspiral b/gstlal-inspiral/bin/gstlal_inspiral
index 32dfa11115..feed29977f 100755
--- a/gstlal-inspiral/bin/gstlal_inspiral
+++ b/gstlal-inspiral/bin/gstlal_inspiral
@@ -567,6 +567,8 @@ offsetvectors = lsctables.TimeSlideTable.get_table(ligolw_utils.load_filename(op
 all_instruments = reduce(lambda a, b: a | set(b), offsetvectors, set())
 if len(all_instruments) < options.min_instruments:
 	raise ValueError("--time-slide-file \"%s\" names %s but we need at least %d instruments" % (options.time_slide_file, ", ".join(sorted(all_instruments)), options.min_instruments))
+if all_instruments != set(detectors.channel_dict):
+	raise ValueError("--time-slide-file names %s but have channel names for %s" % (", ".join(sorted(all_instruments)), ", ".join(sorted(detectors.channel_dict))))
 
 
 #
@@ -581,6 +583,8 @@ if len(all_instruments) < options.min_instruments:
 
 if options.reference_psd is not None:
 	psd = lal.series.read_psd_xmldoc(ligolw_utils.load_filename(options.reference_psd, verbose = options.verbose, contenthandler = lal.series.PSDContentHandler))
+	if set(psd) < all_instruments:
+		raise ValueError("missing PSD(s) for %s" % ", ".join(sorted(all_instruments - set(psd))))
 else:
 	psd = dict((instrument, None) for instrument in detectors.channel_dict)
 
-- 
GitLab