From 17cfb7444e3cb8e9e8f62c20945a38c54bb4e46d Mon Sep 17 00:00:00 2001 From: Johannes Buchner Date: Fri, 10 Apr 2020 02:51:25 +0200 Subject: [PATCH] add verbose reading options; return sample probabilities --- ultranest/integrator.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ultranest/integrator.py b/ultranest/integrator.py index 60053eca..6bdd78d4 100644 --- a/ultranest/integrator.py +++ b/ultranest/integrator.py @@ -2295,7 +2295,7 @@ def plot_run(self): self.logger.debug('Making run plot ... done') -def read_file(log_dir, x_dim, num_bootstraps=20, random=True): +def read_file(log_dir, x_dim, num_bootstraps=20, random=True, verbose=False): """ Read the output HDF5 file of UltraNest. @@ -2309,6 +2309,8 @@ def read_file(log_dir, x_dim, num_bootstraps=20, random=True): number of bootstraps to use for estimating logZ. random: bool use randomization for volume estimation. + verbose: bool + show progress Returns ---------- @@ -2405,6 +2407,8 @@ def pop(Lmin): logvol.append(main_iterator.logVolremaining) niter += 1 + if verbose: + print("%d..." % niter, end='\r') saved_logl.append(Lmin) saved_nodeids.append(node.id) @@ -2474,6 +2478,7 @@ def pop(Lmin): logwt=logwt, niter=niter, logl=saved_logl, + normalised_weights=saved_wt0, ) return sequence, results