Commit a6d1a00b authored by Gregory Ashton's avatar Gregory Ashton
Browse files

Adds progress bar

parent d1a8b85e
......@@ -662,7 +662,16 @@ class MCMCSearch(BaseSearchClass):
return p0
def run(self, proposal_scale_factor=None):
def run_sampler_with_progress_bar(self, sampler, ns, p0):
from tqdm import tqdm
for result in tqdm(sampler.sample(p0, iterations=ns), total=ns):
except ImportError:
sampler.run_mcmc(p0, ns)
return sampler
def run(self, proposal_scale_factor=2):
if self.old_data_is_okay_to_use is True:
logging.warning('Using saved data from {}'.format(
......@@ -689,7 +698,7 @@ class MCMCSearch(BaseSearchClass):
for j, n in enumerate(self.nsteps[:-2]):'Running {}/{} initialisation with {} steps'.format(
j+1, ninit_steps, n))
sampler.run_mcmc(p0, n)
sampler = self.run_sampler_with_progress_bar(sampler, n, p0)"Mean acceptance fraction: {0:.3f}"
if self.ntemps > 1:
......@@ -704,11 +713,14 @@ class MCMCSearch(BaseSearchClass):
nburn = self.nsteps[-2]
if len(self.nsteps) > 1:
nburn = self.nsteps[-2]
nburn = 0
nprod = self.nsteps[-1]'Running final burn and prod with {} steps'.format(
sampler.run_mcmc(p0, nburn+nprod)
sampler = self.run_sampler_with_progress_bar(sampler, nburn+nprod, p0)"Mean acceptance fraction: {0:.3f}"
if self.ntemps > 1:
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment