From 4cd9d8581e3b1daa8006ff3913783f1a8f5e8c05 Mon Sep 17 00:00:00 2001
From: Colm Talbot <colm.talbot@ligo.org>
Date: Tue, 15 May 2018 09:42:59 +1000
Subject: [PATCH] allow zero noise injections

---
 tupak/detector.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tupak/detector.py b/tupak/detector.py
index 1b90f3d06..2aabcf6df 100644
--- a/tupak/detector.py
+++ b/tupak/detector.py
@@ -258,7 +258,11 @@ class Interferometer(object):
             logging.warning('Trying to inject signal which is None.')
         else:
             signal_ifo = self.get_detector_response(waveform_polarizations, parameters)
-            self.data += signal_ifo
+            try:
+                self.data += signal_ifo
+            except TypeError:
+                logging.info('Injecting into zero noise.')
+                self.data = signal_ifo
             opt_snr = np.sqrt(tupak.utils.optimal_snr_squared(signal=signal_ifo, interferometer=self,
                                                               time_duration=1 / (self.frequency_array[1]
                                                                                  - self.frequency_array[0])).real)
-- 
GitLab