From bb02d6c181d1854040681bfbe2a6e3eac5ff045a Mon Sep 17 00:00:00 2001
From: "chad.hanna" <crh184@psu.edu>
Date: Wed, 23 Jan 2019 16:29:48 -0800
Subject: [PATCH] gstlal_inspiral, far, lloidparts: switch to network snr based
 clustering rather than a cut

---
 gstlal-inspiral/bin/gstlal_inspiral  | 2 +-
 gstlal-inspiral/python/far.py        | 3 ++-
 gstlal-inspiral/python/lloidparts.py | 5 +++--
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/gstlal-inspiral/bin/gstlal_inspiral b/gstlal-inspiral/bin/gstlal_inspiral
index 0db35cf91b..58adff95bb 100755
--- a/gstlal-inspiral/bin/gstlal_inspiral
+++ b/gstlal-inspiral/bin/gstlal_inspiral
@@ -834,7 +834,7 @@ for output_file_number, (svd_bank_url_dict, output_url, ranking_stat_output_url,
 		sngls_snr_threshold = options.singles_threshold,
 		tag = options.job_tag,
 		kafka_server = options.output_kafka_server,
-		cluster = options.data_source in ("lvshm", "framexmit"),# we cluster when running online within thinca.
+		cluster = True,#options.data_source in ("lvshm", "framexmit"),# If uncommented, we only cluster when running online
 		verbose = options.verbose
 	)
 	if options.verbose:
diff --git a/gstlal-inspiral/python/far.py b/gstlal-inspiral/python/far.py
index 7d40b7d447..55c276834a 100644
--- a/gstlal-inspiral/python/far.py
+++ b/gstlal-inspiral/python/far.py
@@ -129,7 +129,8 @@ class RankingStat(snglcoinc.LnLikelihoodRatioMixin):
 		pass
 
 	# network SNR threshold
-	network_snrsq_threshold = 5.0**2.
+	# now clustering is enabled
+	network_snrsq_threshold = 0
 
 	def __init__(self, template_ids = None, instruments = frozenset(("H1", "L1", "V1")), population_model_file = None, min_instruments = 1, delta_t = 0.005, horizon_factors = None):
 		self.numerator = inspiral_lr.LnSignalDensity(template_ids = template_ids, instruments = instruments, delta_t = delta_t, population_model_file = population_model_file, min_instruments = min_instruments, horizon_factors = horizon_factors)
diff --git a/gstlal-inspiral/python/lloidparts.py b/gstlal-inspiral/python/lloidparts.py
index aec742699a..c020f55aef 100644
--- a/gstlal-inspiral/python/lloidparts.py
+++ b/gstlal-inspiral/python/lloidparts.py
@@ -691,10 +691,11 @@ def mkLLOIDmulti(pipeline, detectors, banks, psd, psd_fft_length = 32, ht_gate_t
 		if chisq_type == 'autochisq':
 			# FIXME don't hardcode
 			# peak finding window (n) in samples is 1 second at max rate, ie max(rates)
+			nsamps_window = max(max(bank.get_rates()) / 4, 256) # FIXME stupid hack
 			if instrument == 'H1' or instrument == 'L1':
-				head = pipeparts.mkitac(pipeline, snr, 1 * max(bank.get_rates()), bank.template_bank_filename, autocorrelation_matrix = bank.autocorrelation_bank, mask_matrix = bank.autocorrelation_mask, snr_thresh = 4, sigmasq = bank.sigmasq)
+				head = pipeparts.mkitac(pipeline, snr, nsamps_window, bank.template_bank_filename, autocorrelation_matrix = bank.autocorrelation_bank, mask_matrix = bank.autocorrelation_mask, snr_thresh = 4, sigmasq = bank.sigmasq)
 			else:
-				head = pipeparts.mkitac(pipeline, snr, 1 * max(bank.get_rates()), bank.template_bank_filename, autocorrelation_matrix = bank.autocorrelation_bank, mask_matrix = bank.autocorrelation_mask, snr_thresh = bank.snr_threshold, sigmasq = bank.sigmasq)
+				head = pipeparts.mkitac(pipeline, snr, nsamps_window, bank.template_bank_filename, autocorrelation_matrix = bank.autocorrelation_bank, mask_matrix = bank.autocorrelation_mask, snr_thresh = bank.snr_threshold, sigmasq = bank.sigmasq)
 			if verbose:
 				head = pipeparts.mkprogressreport(pipeline, head, "progress_xml_%s" % suffix)
 			triggersrcs[instrument].add(head)
-- 
GitLab