From c4d47e58dc3b004cac4e57853db06f68a581d3f6 Mon Sep 17 00:00:00 2001
From: Chad Hanna <chad.hanna@comp-hd-002.gwave.ics.psu.edu>
Date: Sun, 8 Sep 2019 20:34:55 +0000
Subject: [PATCH] inspiral_lr.py: simplify the noise model to be just the power
 law in SNR

(cherry picked from commit 03f4eafd0b32f86b65875e8e69df7e803c28e6bb)
---
 gstlal-inspiral/python/stats/inspiral_lr.py | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/gstlal-inspiral/python/stats/inspiral_lr.py b/gstlal-inspiral/python/stats/inspiral_lr.py
index b199447a77..8720c7ed51 100644
--- a/gstlal-inspiral/python/stats/inspiral_lr.py
+++ b/gstlal-inspiral/python/stats/inspiral_lr.py
@@ -795,7 +795,7 @@ class LnNoiseDensity(LnLRDensity):
 			# added
 			self.interps = dict((key, (pdf + self.lnzerolagdensity.densities[key]).mkinterp()) for key, pdf in self.densities.items())
 
-	def add_noise_model(self, number_of_events = 10000, prefactors_range = (2.0, 100.), df = 40, inv_snr_pow = 2.):
+	def add_noise_model(self, number_of_events = 1):
 		#
 		# populate snr,chi2 binnings with a slope to force
 		# higher-SNR events to be assesed to be more significant
@@ -814,22 +814,18 @@ class LnNoiseDensity(LnLRDensity):
 		rcoss, drcoss = lnpdf.bins[1].centres()[rcossindices], lnpdf.bins[1].upper()[rcossindices] - lnpdf.bins[1].lower()[rcossindices]
 
 		prcoss = numpy.ones(len(rcoss))
-		# This adds a faint power law that falls off just faster than GWs
-		psnr = 1e-12 * snr**-6 #(1. + 10**6) / (1. + snr**6)
+		# This adds a faint power law that falls off faster than GWs
+		psnr = snr**-12
 		psnr = numpy.outer(psnr, numpy.ones(len(rcoss)))
-		# NOTE the magic numbers are just tuned from real data
-		psnrdcoss = numpy.outer(numpy.exp(-4. * (snr - 4.5)**2) * dsnr, numpy.exp(-(rcoss - .06)**2 / (1e-4)) * drcoss)
-		arr[snrindices, rcossindices] = psnrdcoss + psnr
+		arr[snrindices, rcossindices] = psnr
 
 		# normalize to the requested count.  give 99% of the
 		# requested events to this portion of the model
-		arr *= 0.99 * number_of_events / arr.sum()
+		arr *= number_of_events / arr.sum()
 
 		for lnpdf in self.densities.values():
-			# add in the 99% noise model
+			# add in the noise model
 			lnpdf.array += arr
-			# add 1% from the "glitch model"
-			inspiral_extrinsics.NumeratorSNRCHIPDF.add_glitch_model(lnpdf, n = 0.01 * number_of_events, prefactors_range = prefactors_range, df = df, inv_snr_pow = inv_snr_pow, snr_min = self.snr_min)
 			# re-normalize
 			lnpdf.normalize()
 
-- 
GitLab