From 131403b767faada0b37d33492b2e8a54aa3121bd Mon Sep 17 00:00:00 2001
From: Madeline Wade <wademc@ldas-pcdev1.ligo-wa.caltech.edu>
Date: Wed, 15 Jan 2014 15:07:45 -0800
Subject: [PATCH] Temporary fix to calibration pipeline to deal with ldas-tools
 incompatibility, and temporary fix to lal_logical_undersampler to deal with
 0-length hearbeat buffers

---
 gstlal-calibration/bin/gstlal_compute_strain              | 3 ++-
 gstlal-calibration/gst/python/lal_logical_undersampler.py | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gstlal-calibration/bin/gstlal_compute_strain b/gstlal-calibration/bin/gstlal_compute_strain
index a98a4a7819..18bb537ea3 100755
--- a/gstlal-calibration/bin/gstlal_compute_strain
+++ b/gstlal-calibration/bin/gstlal_compute_strain
@@ -158,7 +158,8 @@ if options.data_source != "white":
 	channel_list = gw_data_source.channel_dict.items()
 	dq_channel_list = (instrument, gw_data_source.dq_channel_dict[instrument])
 	channel_list.append(dq_channel_list)
-	demux = pipeparts.mkframecppchanneldemux(pipeline, src, do_file_checksum = True, skip_bad_files = True, channel_list = map("%s:%s".__mod__, channel_list))
+	#demux = pipeparts.mkframecppchanneldemux(pipeline, src, do_file_checksum = True, skip_bad_files = True, channel_list = map("%s:%s".__mod__, channel_list))
+	demux = pipeparts.mkframecppchanneldemux(pipeline, src, skip_bad_files = True, channel_list = map("%s:%s".__mod__, channel_list))
 	# Write the pipeline graph after pads have been hooked up to the demuxer
 	if options.write_pipeline is not None:
 		demux.connect("no-more-pads", write_graph)	
diff --git a/gstlal-calibration/gst/python/lal_logical_undersampler.py b/gstlal-calibration/gst/python/lal_logical_undersampler.py
index 71887bdb8a..cdcdf9758a 100644
--- a/gstlal-calibration/gst/python/lal_logical_undersampler.py
+++ b/gstlal-calibration/gst/python/lal_logical_undersampler.py
@@ -299,6 +299,9 @@ class lal_logical_undersampler(gst.BaseTransform):
 			gst.Buffer.flag_unset(buf, gst.BUFFER_FLAG_GAP)
 		
 	def do_transform(self, inbuf, outbuf):
+		# FIXME: I'm not sure this is the right fix for hearbeat buffers, so I need to check this!
+		if len(inbuf) == 0:
+			gst.Buffer.flag_set(inbuf, gst.BUFFER_FLAG_GAP)
 		if gst.Buffer.flag_is_set(inbuf, gst.BUFFER_FLAG_DISCONT) or inbuf.offset != self.next_in_offset or self.t0 == gst.CLOCK_TIME_NONE:
 			self.t0 = inbuf.timestamp
 			self.offset0 = self.next_out_offset = gst.util_uint64_scale_int_ceil(inbuf.offset, self.rate_out, self.rate_in)
-- 
GitLab