From 3bc6c72eda53321b62f50352fd34ebffb0baf98c Mon Sep 17 00:00:00 2001
From: Madeline Wade <madeline.wade@ligo.org>
Date: Wed, 23 Jan 2019 12:08:35 -0800
Subject: [PATCH] Fixing a few bugs in the new state vector calculation

---
 gstlal-calibration/bin/gstlal_compute_strain  |  4 +--
 .../check_calibration/statevector_plot.py     | 34 +++++++++++++++++++
 .../check_calibration/timeserieskappas.py     |  2 +-
 3 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/gstlal-calibration/bin/gstlal_compute_strain b/gstlal-calibration/bin/gstlal_compute_strain
index d960f00d88..3f0b429a7a 100755
--- a/gstlal-calibration/bin/gstlal_compute_strain
+++ b/gstlal-calibration/bin/gstlal_compute_strain
@@ -2041,9 +2041,9 @@ if compute_calib_statevector:
 				if ((filterclock_channel_list[i][j] != obsintent_channel_name and filterclock_channel_list[i][j] != lownoise_channel_name) and key in filterclock_channel_list[i]):
 					filterclock_channels.append(calibration_parts.mkqueue(pipeline, pipeparts.mkcapsfilter(pipeline, pipeparts.mkgeneric(pipeline, calibration_parts.caps_and_progress(pipeline, head_dict[key], filterclock_caps[i],key), "lal_logicalundersample", required_on = filterclock_bitmask_list[i], status_out = 1), calibstate_caps)))
 				elif (filterclock_channel_list[i][j] == obsintent_channel_name and key == "obsintent"):
-					filterclock_channels.append(calibration_parts.mkqueue(pipeline, pipeparts.mkcapsfilter(pipeline, pipeparts.mkgeneric(pipeline, obsintenttee, "lal_logicalundersample", required_on = filterclock_bitmask_list[i], status_out = 1), calibstate_caps)))
+					filterclock_channels.append(calibration_parts.mkqueue(pipeline, pipeparts.mkcapsfilter(pipeline, pipeparts.mkgeneric(pipeline, obsintenttee, "lal_logicalundersample", required_on = pow(2,1), status_out = 1), calibstate_caps)))
 				elif (filterclock_channel_list[i][j] == lownoise_channel_name and key == "lownoise"):
-					filterclock_channels.append(calibration_parts.mkqueue(pipeline, pipeparts.mkcapsfilter(pipeline, pipeparts.mkgeneric(pipeline, lownoisetee, "lal_logicalundersample", required_on = filterclock_bitmask_list[i], status_out = 1), calibstate_caps)))
+					filterclock_channels.append(calibration_parts.mkqueue(pipeline, pipeparts.mkcapsfilter(pipeline, pipeparts.mkgeneric(pipeline, lownoisetee, "lal_logicalundersample", required_on = pow(2,2), status_out = 1), calibstate_caps)))
 	if len(filterclock_channel_list) > 1:
 		filtersok = pipeparts.mkadder(pipeline, tuple(filterclock_channels))
 	else:
diff --git a/gstlal-calibration/tests/check_calibration/statevector_plot.py b/gstlal-calibration/tests/check_calibration/statevector_plot.py
index 25e89275b1..03e2af0c49 100644
--- a/gstlal-calibration/tests/check_calibration/statevector_plot.py
+++ b/gstlal-calibration/tests/check_calibration/statevector_plot.py
@@ -25,6 +25,40 @@ calib_state_channel_name = options.calib_state_vector_channel_name
 
 calib_state_vector = StateVector.read(hoft_frames_cache, "%s:%s" % (ifo, calib_state_channel_name), start = start, end = end)
 
+# define list of labels
+labels = [
+	'h(t) OK',
+	'Obs. intent',
+	'Obs. ready',
+	'Filters OK',
+	'No gap',
+	'No Stoch. inj.',
+	'No CBC inj.',
+	'No Burst inj.',
+	'No DetChar inj.',
+	'ktst smooth',
+	'kpum smooth',
+	'kuim smooth',
+	'kc smooth',
+	'fcc smooth',
+	'fs smooth',
+	'qinv smooth',
+	'SUS line3 coh.',
+	'SUS line2 coh.',
+	'SUS line1 coh.',
+	'PCALY line1 coh.',
+	'PCALY line2 coh.',
+	'PCALY line4 coh.',
+	'DARM EP match',
+	'A EP match',
+	'C EP match',
+	'MISC EP match',
+	'Line subtr.',
+	'Noise subtr.',
+	'Noise subtr. gate'
+]
+calib_state_vector.bits = labels
+
 plot = calib_state_vector.plot(format='segments')
 ax = plot.gca()
 ax.set_xscale('seconds')
diff --git a/gstlal-calibration/tests/check_calibration/timeserieskappas.py b/gstlal-calibration/tests/check_calibration/timeserieskappas.py
index befe4c057f..f41d7db39f 100644
--- a/gstlal-calibration/tests/check_calibration/timeserieskappas.py
+++ b/gstlal-calibration/tests/check_calibration/timeserieskappas.py
@@ -27,7 +27,7 @@ if options.channel_list is not None:
 else:
 	raise ValueError('Channel list option must be set.')
 
-data = TimeSeriesDict.read(options.frame_cache, channels = map("%s:%s".__mod__, channel_list), start = start, end = end)
+data = TimeSeriesDict.read(options.frame_cache, map("%s:%s".__mod__, channel_list), start = start, end = end)
 
 segs = DataQualityFlag.query('%s:DMT-CALIBRATED:1' % ifo, start, end)
 
-- 
GitLab