From 2f57d31ae9a93ecf505e55128a10393a5c2a9d61 Mon Sep 17 00:00:00 2001
From: Aaron Viets <aaron.viets@ligo.org>
Date: Thu, 1 Aug 2019 11:37:21 -0700
Subject: [PATCH] gstlal_compute_strain:  lower resampler quality for lower
 latency and computational cost.

---
 gstlal-calibration/bin/gstlal_compute_strain | 32 ++++++++++----------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/gstlal-calibration/bin/gstlal_compute_strain b/gstlal-calibration/bin/gstlal_compute_strain
index 8a075c40e5..d57f259316 100755
--- a/gstlal-calibration/bin/gstlal_compute_strain
+++ b/gstlal-calibration/bin/gstlal_compute_strain
@@ -2022,21 +2022,21 @@ if CalibrationConfigs["calibrationmode"] == "Partial":
 
 	# if you need to, dewhiten the TST and PUM/UIM chains
 	if dewhitening:
-		tst = calibration_parts.mkresample(pipeline, tsttee, 5, False, "audio/x-raw, format=F64LE, rate=%d" % tstdewhitensr) 
+		tst = calibration_parts.mkresample(pipeline, tsttee, 4, False, "audio/x-raw, format=F64LE, rate=%d" % tstdewhitensr) 
 		tst = pipeparts.mkfirbank(pipeline, tst, latency = int(tstdewhitendelay), fir_matrix = [tstdewhiten[::-1]], time_domain = td)
 		tst_filter_settle_time += float(len(tstdewhiten)-tstdewhitendelay)/tstdewhitensr
 		tst_filter_latency += float(tstdewhitendelay)/tstdewhitensr
 		if apply_kappapum or apply_kappauim or apply_complex_kappapum or apply_complex_kappauim:
-			pum = calibration_parts.mkresample(pipeline, pum, 5, False, "audio/x-raw, format=F64LE, rate=%d" % pumdewhitensr)
+			pum = calibration_parts.mkresample(pipeline, pum, 4, False, "audio/x-raw, format=F64LE, rate=%d" % pumdewhitensr)
 			pum = pipeparts.mkfirbank(pipeline, pum, latency = int(pumdewhitendelay), fir_matrix = [pumdewhiten[::-1]], time_domain = td)
 			pum_filter_settle_time += float(len(pumdewhiten)-pumdewhitendelay)/pumdewhitensr
 			pum_filter_latency += float(pumdewhitendelay)/pumdewhitensr
-			uim = calibration_parts.mkresample(pipeline, uim, 5, False, "audio/x-raw, format=F64LE, rate=%d" % uimdewhitensr)
+			uim = calibration_parts.mkresample(pipeline, uim, 4, False, "audio/x-raw, format=F64LE, rate=%d" % uimdewhitensr)
 			uim = pipeparts.mkfirbank(pipeline, uim, latency = int(uimdewhitendelay), fir_matrix = [uimdewhiten[::-1]], time_domain = td)
 			uim_filter_settle_time += float(len(uimdewhiten)-uimdewhitendelay)/uimdewhitensr
 			uim_filter_latency += float(uimdewhitendelay)/uimdewhitensr
 		else:
-			pumuim = calibration_parts.mkresample(pipeline, pumuim, 5, False, "audio/x-raw, format=F64LE, rate=%d" % pumuimdewhitensr)
+			pumuim = calibration_parts.mkresample(pipeline, pumuim, 4, False, "audio/x-raw, format=F64LE, rate=%d" % pumuimdewhitensr)
 			pumuim = pipeparts.mkfirbank(pipeline, pumuim, latency = int(pumuimdewhitendelay), fir_matrix = [pumuimdewhiten[::-1]], time_domain = td)
 			pumuim_filter_settle_time += float(len(pumuimdewhiten)-pumuimdewhitendelay)/pumuimdewhitensr
 			pumuim_filter_latency += float(pumuimdewhitendelay)/pumuimdewhitensr
@@ -2050,7 +2050,7 @@ if CalibrationConfigs["calibrationmode"] == "Full":
 	
 	if dewhitening:
 		# dewhiten the DARM_CTRL channel
-		ctrl = calibration_parts.mkresample(pipeline, darmctrltee, 5, False, "audio/x-raw, format=F64LE, rate=%d" % ctrldewhitensr)
+		ctrl = calibration_parts.mkresample(pipeline, darmctrltee, 4, False, "audio/x-raw, format=F64LE, rate=%d" % ctrldewhitensr)
 		ctrl = pipeparts.mkfirbank(pipeline, ctrl, latency = int(ctrldewhitendelay), fir_matrix = [ctrldewhiten[::-1]], time_domain = td)
 		tst_filter_settle_time += float(len(ctrldewhiten)-ctrldewhitendelay)/ctrldewhitensr
 		tst_filter_latency += float(ctrldewhitendelay)/ctrldewhitensr
@@ -2072,7 +2072,7 @@ if CalibrationConfigs["calibrationmode"] == "Full":
 	pumuim = ctrltee
 
 # resample what will become the TST actuation chain to the TST FIR filter sample rate
-tst = calibration_parts.mkresample(pipeline, tst, 5, False, "audio/x-raw, format=F64LE, rate=%d" %  tstchainsr)
+tst = calibration_parts.mkresample(pipeline, tst, 4, False, "audio/x-raw, format=F64LE, rate=%d" %  tstchainsr)
 if test_filters:
 	tst = pipeparts.mktee(pipeline, tst)
 	tst_before_filters = tst
@@ -2118,13 +2118,13 @@ if test_filters:
 
 # resample the TST actuation chain if necessary
 if tstchainsr < actsr:
-	tst = calibration_parts.mkresample(pipeline, tst, 5, False, actsr)
+	tst = calibration_parts.mkresample(pipeline, tst, 4, False, actsr)
 
 # Check whether we need to filter the PUM and UIM stages separately or together
 if apply_kappapum or apply_kappauim or apply_complex_kappapum or apply_complex_kappauim:
 	# resample what will become the PUM and UIM actuation paths to the PUM and UIM FIR filter sample rates
-	pum = calibration_parts.mkresample(pipeline, pumtee, 5, False, "audio/x-raw, format=F64LE, rate=%d" % pumchainsr)
-	uim = calibration_parts.mkresample(pipeline, uimtee, 5, False, "audio/x-raw, format=F64LE, rate=%d" % uimchainsr)
+	pum = calibration_parts.mkresample(pipeline, pumtee, 4, False, "audio/x-raw, format=F64LE, rate=%d" % pumchainsr)
+	uim = calibration_parts.mkresample(pipeline, uimtee, 4, False, "audio/x-raw, format=F64LE, rate=%d" % uimchainsr)
 	if test_filters:
 		pum = pipeparts.mktee(pipeline, pum)
 		pum_before_filters = pum
@@ -2205,17 +2205,17 @@ if apply_kappapum or apply_kappauim or apply_complex_kappapum or apply_complex_k
 
 	# resample the PUM actuation path if necessary
 	if pumchainsr < actsr:
-		pum = calibration_parts.mkresample(pipeline, pum, 5, False, actsr)
+		pum = calibration_parts.mkresample(pipeline, pum, 4, False, actsr)
 
 	# resample the UIM actuation path if necessary
 	if uimchainsr < actsr:
-		uim = calibration_parts.mkresample(pipeline, uim, 5, False, actsr)
+		uim = calibration_parts.mkresample(pipeline, uim, 4, False, actsr)
 
 	# Add the TST, PUM, and UIM paths together to form the full actuation path
 	ctrl = calibration_parts.mkadder(pipeline, calibration_parts.list_srcs(pipeline, tst, pum, uim))
 else:
 	# resample what will become the PUM/UIM actuation chain to the PUM/UIM FIR filter sample rate
-	pumuim = calibration_parts.mkresample(pipeline, pumuim, 5, False, "audio/x-raw, format=F64LE, rate=%d" % pumuimchainsr)
+	pumuim = calibration_parts.mkresample(pipeline, pumuim, 4, False, "audio/x-raw, format=F64LE, rate=%d" % pumuimchainsr)
 	if test_filters:
 		pumuim = pipeparts.mktee(pipeline, pumuim)
 		pumuim_before_filters = pumuim
@@ -2261,14 +2261,14 @@ else:
 
 	# resample the PUM/UIM actuation chain if necessary
 	if pumuimchainsr < actsr:
-		pumuim = calibration_parts.mkresample(pipeline, pumuim, 5, False, actsr)
+		pumuim = calibration_parts.mkresample(pipeline, pumuim, 4, False, actsr)
 
 	# Add the TST and PUM/UIM chains together to form the full actuation chain
 	ctrl = calibration_parts.mkadder(pipeline, calibration_parts.list_srcs(pipeline, tst, pumuim))
 
 # Resample \DeltaL_ctrl to the full h(t) sample rate
 if actsr != hoft_sr:
-	ctrl = calibration_parts.mkresample(pipeline, ctrl, 5, False, hoft_caps)
+	ctrl = calibration_parts.mkresample(pipeline, ctrl, 4, False, hoft_caps)
 
 if test_latency:
 	ctrl = pipeparts.mklatency(pipeline, ctrl, name = "%s_ctrl" % OutputConfigs["frametype"])
@@ -2303,13 +2303,13 @@ if any(invsens_highpass):
 	if invsens_highpass_sr != hoft_sr:
 		# Magic trick to apply a high-pass filter to the inverse sensing path at a lower sample rate without losing information above the Nyquist frequency.
 		res = pipeparts.mktee(pipeline, res)
-		res_lowfreq = calibration_parts.mkresample(pipeline, res, 5, False, invsens_highpass_sr)
+		res_lowfreq = calibration_parts.mkresample(pipeline, res, 4, False, invsens_highpass_sr)
 		# Use spectral inversion to make a low-pass filter with a gain of -1.
 		invsens_highpass[invsens_highpass_delay] = invsens_highpass[invsens_highpass_delay] - 1.0
 		# Apply this filter to the inverse sensing path at a lower sample rate to get only the low frequency components
 		res_lowfreq = pipeparts.mkfirbank(pipeline, res_lowfreq, latency = invsens_highpass_delay, fir_matrix = [invsens_highpass[::-1]], time_domain = td)
 		# Upsample
-		res_lowfreq = calibration_parts.mkresample(pipeline, res_lowfreq, 5, False, hoft_sr)
+		res_lowfreq = calibration_parts.mkresample(pipeline, res_lowfreq, 4, False, hoft_sr)
 		# Add to the inverse sensing path to get rid of the low frequencies
 		res = calibration_parts.mkadder(pipeline, calibration_parts.list_srcs(pipeline, res, res_lowfreq))
 	else:
-- 
GitLab