From b26d1c74c4a94ea50ed67ff056499da20db738ea Mon Sep 17 00:00:00 2001
From: Gregory Ashton <gregory.ashton@ligo.org>
Date: Tue, 27 Sep 2016 12:15:38 +0200
Subject: [PATCH] Forces output of Fstat to be finite and non-nan

It seems that , due to the choice of transient windows, occasionally
the calculated Fstat is +/- inf or a nan. This behaviour is not
understood. To address this, we apply a simple check and if it is an
undesirable value, return 0. This will inherently bias the chains away
from regions of parameter space in which the output breaks.
---
 pyfstat.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/pyfstat.py b/pyfstat.py
index 6442f3a..4509aa1 100755
--- a/pyfstat.py
+++ b/pyfstat.py
@@ -374,7 +374,10 @@ class SemiCoherentGlitchSearch(BaseSearchClass, ComputeFstat):
                 theta_i_at_tref[3], Alpha, Delta)
             twoFSum += twoFVal
 
-        return twoFSum
+        if np.isfinite(twoFSum):
+            return twoFSum
+        else:
+            return 0
 
     def compute_glitch_fstat_single(self, F0, F1, F2, Alpha, Delta, delta_F0,
                                     delta_F1, tglitch):
-- 
GitLab