From b55f9c56d9557567a53de7d740ccf9486d0e92e1 Mon Sep 17 00:00:00 2001
From: Gregory Ashton <gregory.ashton@ligo.org>
Date: Sun, 28 Jul 2019 20:07:19 -0700
Subject: [PATCH] Fix tests and increase dlogz

---
 bilby/core/sampler/dynesty.py |  6 +++---
 test/sampler_test.py          | 14 ++++++--------
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/bilby/core/sampler/dynesty.py b/bilby/core/sampler/dynesty.py
index bc88b0274..80de8ca63 100644
--- a/bilby/core/sampler/dynesty.py
+++ b/bilby/core/sampler/dynesty.py
@@ -55,8 +55,8 @@ class Dynesty(NestedSampler):
         Method used to sample uniformly within the likelihood constraints,
         conditioned on the provided bounds
     walks: int
-        Number of walks taken if using `sample='rwalk'`, defaults to `ndim * 5`
-    dlogz: float, (0.1)
+        Number of walks taken if using `sample='rwalk'`, defaults to `ndim * 30`
+    dlogz: float, (0.5)
         Stopping criteria
     verbose: Bool
         If true, print information information about the convergence during
@@ -85,7 +85,7 @@ class Dynesty(NestedSampler):
                           enlarge=None, bootstrap=None, vol_dec=0.5, vol_check=2.0,
                           facc=0.5, slices=5,
                           update_interval=None, print_func=None,
-                          dlogz=0.1, maxiter=None, maxcall=None,
+                          dlogz=0.5, maxiter=None, maxcall=None,
                           logl_max=np.inf, add_live=True, print_progress=True,
                           save_bounds=False)
 
diff --git a/test/sampler_test.py b/test/sampler_test.py
index 6bb4a4a24..118291092 100644
--- a/test/sampler_test.py
+++ b/test/sampler_test.py
@@ -5,7 +5,6 @@ import unittest
 from mock import MagicMock
 import numpy as np
 import os
-import sys
 import shutil
 import copy
 
@@ -152,16 +151,15 @@ class TestDynesty(unittest.TestCase):
                         use_pool=None, live_points=None, logl_args=None, logl_kwargs=None,
                         ptform_args=None, ptform_kwargs=None,
                         enlarge=None, bootstrap=None, vol_dec=0.5, vol_check=2.0,
-                        facc=0.5, slices=5, dlogz=0.1, maxiter=None, maxcall=None,
+                        facc=0.5, slices=5, dlogz=0.5, maxiter=None, maxcall=None,
                         logl_max=np.inf, add_live=True, print_progress=True, save_bounds=False,
-                        walks=20, update_interval=600, print_func='func')
+                        walks=60, update_interval=600, print_func='func')
         self.sampler.kwargs['print_func'] = 'func'  # set this manually as this is not testable otherwise
         self.assertListEqual([0, 1], self.sampler.kwargs['periodic'])  # Check this separately
         self.sampler.kwargs['periodic'] = None  # The dict comparison can't handle lists
         for key in self.sampler.kwargs.keys():
-            print(key)
-            print(expected[key])
-            print(self.sampler.kwargs[key])
+            print("key={}, expected={}, actual={}"
+                  .format(key, expected[key], self.sampler.kwargs[key]))
         self.assertDictEqual(expected, self.sampler.kwargs)
 
     def test_translate_kwargs(self):
@@ -171,9 +169,9 @@ class TestDynesty(unittest.TestCase):
                         use_pool=None, live_points=None, logl_args=None, logl_kwargs=None,
                         ptform_args=None, ptform_kwargs=None,
                         enlarge=None, bootstrap=None, vol_dec=0.5, vol_check=2.0,
-                        facc=0.5, slices=5, dlogz=0.1, maxiter=None, maxcall=None,
+                        facc=0.5, slices=5, dlogz=0.5, maxiter=None, maxcall=None,
                         logl_max=np.inf, add_live=True, print_progress=True, save_bounds=False,
-                        walks=20, update_interval=600, print_func='func')
+                        walks=60, update_interval=600, print_func='func')
 
         for equiv in bilby.core.sampler.base_sampler.NestedSampler.npoints_equiv_kwargs:
             new_kwargs = self.sampler.kwargs.copy()
-- 
GitLab