From e59db56541f5160a397faf5983e2f66624545bfd Mon Sep 17 00:00:00 2001
From: Gregory Ashton <gregory.ashton@ligo.org>
Date: Mon, 25 Jun 2018 11:15:08 +1000
Subject: [PATCH] Regularize default estimation of n_check_point

Make n_check_point estimation round to the nearest order of magnitude.

Fixes #117
---
 tupak/core/sampler.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tupak/core/sampler.py b/tupak/core/sampler.py
index 04b0cb948..267d5a67f 100644
--- a/tupak/core/sampler.py
+++ b/tupak/core/sampler.py
@@ -448,8 +448,10 @@ class Dynesty(Sampler):
             self.__kwargs['update_interval'] = int(0.6 * self.__kwargs['nlive'])
         if 'n_check_point' not in kwargs:
             # checkpointing done by default ~ every 10 minutes
-            self.__kwargs['n_check_point'] = int(self.__kwargs['check_point_delta_t']
-                                                 // self._sample_log_likelihood_eval)
+            n_check_point_raw = (self.__kwargs['check_point_delta_t']
+                                 / self._sample_log_likelihood_eval)
+            n_check_point_rnd = int(float("{:1.0g}".format(n_check_point_raw)))
+            self.__kwargs['n_check_point'] = n_check_point_rnd
 
     def _print_func(self, results, niter, ncall, dlogz, *args, **kwargs):
         """ Replacing status update for dynesty.result.print_func """
-- 
GitLab