From 032fb3df7009b8faa22dbc25dceb6d67bbe91faa Mon Sep 17 00:00:00 2001
From: Gregory Ashton <gregory.ashton@ligo.org>
Date: Mon, 20 Jul 2020 18:07:48 +1000
Subject: [PATCH] Make the SNR calculation identical if done with an dataframe
 or dict

---
 bilby/gw/conversion.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/bilby/gw/conversion.py b/bilby/gw/conversion.py
index ca7f157ed..0b1f3aacc 100644
--- a/bilby/gw/conversion.py
+++ b/bilby/gw/conversion.py
@@ -1116,13 +1116,14 @@ def compute_snrs(sample, likelihood):
         if isinstance(sample, dict):
             signal_polarizations =\
                 likelihood.waveform_generator.frequency_domain_strain(sample)
+            likelihood.parameters.update(sample)
             for ifo in likelihood.interferometers:
-                signal = ifo.get_detector_response(signal_polarizations, sample)
+                per_detector_snr = likelihood.calculate_snrs(
+                    signal_polarizations, ifo)
                 sample['{}_matched_filter_snr'.format(ifo.name)] =\
-                    ifo.matched_filter_snr(signal=signal)
+                    per_detector_snr.complex_matched_filter_snr
                 sample['{}_optimal_snr'.format(ifo.name)] = \
-                    ifo.optimal_snr_squared(signal=signal) ** 0.5
-
+                    per_detector_snr.optimal_snr_squared.real ** 0.5
         else:
             logger.info(
                 'Computing SNRs for every sample.')
-- 
GitLab