From b65555e378cb8a54f6afd762eff4f470efa2afb5 Mon Sep 17 00:00:00 2001
From: Michael Williams <michael.williams@ligo.org>
Date: Thu, 26 Nov 2020 09:26:39 -0600
Subject: [PATCH] Fix likelihood count for Dynesty

---
 bilby/core/sampler/dynesty.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/bilby/core/sampler/dynesty.py b/bilby/core/sampler/dynesty.py
index c841478b..9d8a66a9 100644
--- a/bilby/core/sampler/dynesty.py
+++ b/bilby/core/sampler/dynesty.py
@@ -690,6 +690,16 @@ class Dynesty(NestedSampler):
         """
         return self.priors.rescale(self._search_parameter_keys, theta)
 
+    def calc_likelihood_count(self):
+        if self.likelihood_benchmark:
+            if hasattr(self, 'sampler'):
+                self.result.num_likelihood_evaluations = \
+                    getattr(self.sampler, 'ncall', 0)
+            else:
+                self.result.num_likelihood_evaluations = 0
+        else:
+            return None
+
 
 def sample_rwalk_bilby(args):
     """ Modified bilby-implemented version of dynesty.sampling.sample_rwalk """
-- 
GitLab