From 1bf0cce6a9b58465d0168bfbf7bd90013dc2c600 Mon Sep 17 00:00:00 2001
From: "chad.hanna" <crh184@psu.edu>
Date: Thu, 4 Oct 2018 18:00:11 -0700
Subject: [PATCH] gstlal_inspiral: move the make_horizon_distance function to
 svd_bank

---
 gstlal-inspiral/bin/gstlal_inspiral | 21 +--------------------
 1 file changed, 1 insertion(+), 20 deletions(-)

diff --git a/gstlal-inspiral/bin/gstlal_inspiral b/gstlal-inspiral/bin/gstlal_inspiral
index 5719bb986c..c4702b7299 100755
--- a/gstlal-inspiral/bin/gstlal_inspiral
+++ b/gstlal-inspiral/bin/gstlal_inspiral
@@ -534,25 +534,6 @@ class OneTimeSignalHandler(object):
 #
 
 
-def make_horizon_distance_func(banks, sngl_inspiral_table):
-	# span is [15 Hz, 0.85 * Nyquist frequency]
-	# find the Nyquist frequency for the PSD to be used for each
-	# instrument.  require them to all match
-	nyquists = set(max(rate for bank in banklist for rate in bank.get_rates()) // 2 for instrument, banklist in banks.items())
-	assert len(nyquists) == 1, "all banks must have the same Nyquist frequency to define a consistent horizon distance function (got %s)" % ", ".join("%g" % rate for rate in sorted(nyquists))
-	# assume default 32 s PSD.  this is not required to be correct, but
-	# for best accuracy it should not be larger than the true value and
-	# for best performance it should not be smaller than the true
-	# value.
-	deltaF = 1. / 32.
-	# pick (m1, m2) from the median template ranked by Mchirp^(5/3)
-	# to provide the canonical waveform model.  See Maggiore equation
-	# (4.3).
-	assert len(sngl_inspiral_table) > 0, "no templates:  must have templates to define horizon distance function"
-	median_row = sorted(sngl_inspiral_table, key = lambda row: row.mchirp**(5./3.))[len(sngl_inspiral_table) // 2]
-	return reference_psd.HorizonDistance(15.0, 0.85 * max(nyquists), deltaF, median_row.mass1, median_row.mass2)
-
-
 #
 # =============================================================================
 #
@@ -824,7 +805,7 @@ for output_file_number, (svd_bank_url_dict, output_url, ranking_stat_output_url,
 			verbose = options.verbose
 		),
 		rankingstat = rankingstat,
-		horizon_distance_func = make_horizon_distance_func(banks, sngl_inspiral_table),
+		horizon_distance_func = svd_bank.make_horizon_distance_func(banks),
 		gracedbwrapper = inspiral.GracedBWrapper(
 			instruments = rankingstat.instruments,
 			far_threshold = options.gracedb_far_threshold,
-- 
GitLab