From b8a07c02bdafbb63519530f64a587de93ca3fc01 Mon Sep 17 00:00:00 2001
From: Gregory Ashton <gregory.ashton@ligo.org>
Date: Wed, 2 Aug 2017 15:53:16 +0200
Subject: [PATCH] Adds DMoff threshold macro

---
 pyfstat/helper_functions.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/pyfstat/helper_functions.py b/pyfstat/helper_functions.py
index dddf0d1..9a8e1f8 100644
--- a/pyfstat/helper_functions.py
+++ b/pyfstat/helper_functions.py
@@ -274,3 +274,10 @@ def get_covering_band(tref, tstart, tend, F0, F1, F2):
     return lalpulsar.CWSignalCoveringBand(tstart, tend, psr, 0, 0, 0)
 
 
+def twoFDMoffThreshold(twoFon, knee=400, twoFDMoffthreshold_below_threshold=62,
+                       prefactor=0.9, offset=0.5):
+    """ Calculation of the 2F_DMoff threshold, see Eq 2 of arXiv:1707.5286 """
+    if twoFon <= knee:
+        return twoFDMoffthreshold_below_threshold
+    else:
+        return 10**(prefactor*np.log10(twoFon-offset))
-- 
GitLab