From 917771a2cd1775d96bd2566265b19d345ee57197 Mon Sep 17 00:00:00 2001
From: Rachael Huxford <rachael.huxford@ligo.org>
Date: Thu, 30 Jun 2022 10:12:12 -0400
Subject: [PATCH] Add support for compression of iDQ history in the dist stat
 files

---
 .../bin/gstlal_inspiral_compress_ranking_stat     | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/gstlal-inspiral/bin/gstlal_inspiral_compress_ranking_stat b/gstlal-inspiral/bin/gstlal_inspiral_compress_ranking_stat
index 57ebff6f67..5c1b1d300b 100755
--- a/gstlal-inspiral/bin/gstlal_inspiral_compress_ranking_stat
+++ b/gstlal-inspiral/bin/gstlal_inspiral_compress_ranking_stat
@@ -57,6 +57,9 @@ def parse_command_line():
 	parser.add_option("-t", "--threshold", type = "float", default = 0.03, help = "Only keep horizon distance values that differ by this much, fractionally, from their neighbours (default = 0.03).")
 	parser.add_option("--remove-horizon-deviations", action = "store_true", help = "Remove horizon entries that display an uncharacteristic deviation in sensitivity from the non-zero mean.")
 	parser.add_option("--deviation-percent", type = "float", default = 0.50, help = "Remove horizon entries that deviate by this fraction from the non-zero mean.")
+	parser.add_option("--idq-threshold", type = "float", default = 0.01, help = "Only keep integrated idq lnl history values that differ by this much, fractionally, from their neighbours (default = 0.01).")
+	parser.add_option("--remove-idq-deviations", action = "store_true", help = "Remove idq entries that display an uncharacteristic deviation in sensitivity from the non-zero mean.")
+	parser.add_option("--idq-deviation-percent", type = "float", default = 0.50, help = "Remove idq entries that deviate by this fraction from the non-zero mean. (default = 0.5)")
 	parser.add_option("-v", "--verbose", action = "store_true", help = "Be verbose.")
 	options, filenames = parser.parse_args()
 
@@ -148,6 +151,18 @@ for filename in filenames:
 		# replace
 		rankingstat.numerator.horizon_history[instrument] = type(horizon_history)(items)
 
+
+	#
+	# compress idq history.
+	#
+
+	rankingstat.numerator.idq_glitch_lnl_history.compress(
+		threshold = options.idq_threshold,
+		remove_deviations = options.remove_idq_deviations,
+		deviation_percent = options.idq_deviation_percent
+	)
+
+
 	#
 	# re-insert into XML tree
 	#
-- 
GitLab