From 5a391e856d6197693527b7f9088b90e5c7e814ca Mon Sep 17 00:00:00 2001
From: "gregory.ashton" <gregory.ashton@ligo.org>
Date: Tue, 4 Apr 2017 18:28:53 +0200
Subject: [PATCH] If a nan is returned, return 0 instead

A hack fix for the internal error in LALSUITE - this should be reversed
once we have solved the fundamental issue: if the data contains no sfts
for that period, return 0 not nan
---
 pyfstat/core.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/pyfstat/core.py b/pyfstat/core.py
index aceda60..a4784bf 100755
--- a/pyfstat/core.py
+++ b/pyfstat/core.py
@@ -440,7 +440,11 @@ class ComputeFstat(object):
             self.FstatResults.multiFatoms[0], self.windowRange, False)
 
         if self.BSGL is False:
-            return 2*FS.F_mn.data[0][0]
+            twoF = 2*FS.F_mn.data[0][0]
+            if np.isnan(twoF):
+                return 0
+            else:
+                return twoF
 
         FstatResults_single = copy.copy(self.FstatResults)
         FstatResults_single.lenth = 1
-- 
GitLab