From 1629130d175e70919a5101fa265465dc79d6e309 Mon Sep 17 00:00:00 2001
From: Siddharth Rajiv Mohite <siddharth.mohite@ldas-grid.ligo.caltech.edu>
Date: Wed, 5 Dec 2018 15:06:03 -0800
Subject: [PATCH] Added the fmax option to injection_snr and pipe

---
 gstlal-inspiral/bin/gstlal_inspiral_injection_snr | 3 ++-
 gstlal-inspiral/bin/gstlal_inspiral_pipe          | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/gstlal-inspiral/bin/gstlal_inspiral_injection_snr b/gstlal-inspiral/bin/gstlal_inspiral_injection_snr
index 12ca76e830..1809b1c545 100755
--- a/gstlal-inspiral/bin/gstlal_inspiral_injection_snr
+++ b/gstlal-inspiral/bin/gstlal_inspiral_injection_snr
@@ -52,6 +52,7 @@ def parse_command_line():
 	parser.add_option("--reference-psd-cache", metavar = "filename", help = "Set the reference psd cache file.")
 	parser.add_option("--injection-file", metavar = "filename", help = "Set the injection xml file.")
 	parser.add_option("--flow", metavar = "value", type = "float", help = "Set the low frequency for waveform generation and SNR integral.")
+        parser.add_option("--fmax", metavar = "value", type = "float",default=1600, help = "Set the max frequency for waveform generation and SNR integral.Default 1600Hz")
 	parser.add_option("--npool", metavar = "value", type = "int", default = 2, help = "Set value for pool. Number of parallel sub-processes")
 
 	options, filenames = parser.parse_args()
@@ -133,7 +134,7 @@ def calc_expected_snr(inj):
 		if instrument not in chosenPSD:
 			continue
 		h = lalsimulation.SimDetectorStrainREAL8TimeSeries(h_plus, h_cross, inj.longitude, inj.latitude, inj.polarization, lalsimulation.DetectorPrefixToLALDetector(instrument))
-		snr[instrument] = lalsimulation.MeasureSNR(h, chosenPSD[instrument], options.flow, 0.85 * (sample_rate / 2.))
+		snr[instrument] = lalsimulation.MeasureSNR(h, chosenPSD[instrument], options.flow, options.fmax)
 
 	return snr
 
diff --git a/gstlal-inspiral/bin/gstlal_inspiral_pipe b/gstlal-inspiral/bin/gstlal_inspiral_pipe
index 32e0bf30c0..a09bd5a6ae 100755
--- a/gstlal-inspiral/bin/gstlal_inspiral_pipe
+++ b/gstlal-inspiral/bin/gstlal_inspiral_pipe
@@ -1027,6 +1027,7 @@ def parse_command_line():
 	parser.add_option("--bank-cache", metavar = "filenames", action = "append", help = "Set the bank cache files in format H1=H1.cache,H2=H2.cache, etc.. (can be given multiple times)")
 	parser.add_option("--tolerance", metavar = "float", type = "float", default = 0.9999, help = "set the SVD tolerance, default 0.9999")
 	parser.add_option("--flow", metavar = "num", type = "float", default = 40, help = "set the low frequency cutoff, default 40 (Hz)")
+        parser.add_option("--fmax", metavar = "num", type = "float", default = 1600, help = "set the max frequency cutoff, default 1600 (Hz)")
 	parser.add_option("--sample-rate", metavar = "Hz", type = "int", help = "Set the sample rate.  If not set, the sample rate will be based on the template frequency.  The sample rate must be at least twice the highest frequency in the templates. If provided it must be a power of two")
 	parser.add_option("--identity-transform", action = "store_true", help = "Use identity transform, i.e. no SVD")
 	
@@ -1371,7 +1372,7 @@ if not options.lloid_cache and not options.disable_calc_inj_snr:
 		# FIXME Use machinery in inspiral_pipe.py to create reference_psd.cache
 		for i in xrange(num_split_inj_snr_jobs):
 			injSNRnode = inspiral_pipe.generic_node(gstlalInjSnrJob, dag, parent_nodes=ref_psd_parent_nodes + [inj_splitter_node],
-				opts = {"flow":options.flow},
+				opts = {"flow":options.flow,"fmax":options.fmax},
 				input_files = {"injection-file": "%s/%s_INJ_SPLIT_%04d.xml" % (injSplitterJob.output_path, sim_tag_from_inj_file(inj.split(":")[-1]), i), "reference-psd-cache": "reference_psd.cache"
 				}
 			)
-- 
GitLab