From 45ecbb4b1be38b61a9f79b92127b96a178a0473f Mon Sep 17 00:00:00 2001 From: "rhys.green" <rhys.green@ligo.org> Date: Thu, 10 Jan 2019 18:21:39 +0000 Subject: [PATCH] adding changes to other files so that they call ptmcmc --- bilby/core/prior.py | 1 - bilby/core/sampler/__init__.py | 5 +++-- bilby/core/sampler/base_sampler.py | 6 +++--- bilby/core/sampler/emcee.py | 1 - 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/bilby/core/prior.py b/bilby/core/prior.py index f783d52eb..214604bc4 100644 --- a/bilby/core/prior.py +++ b/bilby/core/prior.py @@ -280,7 +280,6 @@ def create_default_prior(name, default_priors_file=None): prior = None return prior - class Prior(object): _default_latex_labels = dict() diff --git a/bilby/core/sampler/__init__.py b/bilby/core/sampler/__init__.py index c4e9b7722..f66fecd8b 100644 --- a/bilby/core/sampler/__init__.py +++ b/bilby/core/sampler/__init__.py @@ -12,13 +12,14 @@ from .dynesty import Dynesty from .emcee import Emcee from .nestle import Nestle from .ptemcee import Ptemcee +from .ptmcmc import PTMCMCSampler from .pymc3 import Pymc3 from .pymultinest import Pymultinest -from .ptmcmc import PTMCMCSampler implemented_samplers = { 'cpnest': Cpnest, 'dynesty': Dynesty, 'emcee': Emcee, 'nestle': Nestle, - 'ptemcee': Ptemcee, 'pymc3': Pymc3, 'pymultinest': Pymultinest , 'ptmcmcsampler' : PTMCMCSampler} + 'ptemcee': Ptemcee,'ptmcmcsampler' : PTMCMCSampler, + 'pymc3': Pymc3, 'pymultinest': Pymultinest } if command_line_args.sampler_help: sampler = command_line_args.sampler_help diff --git a/bilby/core/sampler/base_sampler.py b/bilby/core/sampler/base_sampler.py index f450ed374..7eadb0eeb 100644 --- a/bilby/core/sampler/base_sampler.py +++ b/bilby/core/sampler/base_sampler.py @@ -142,14 +142,14 @@ class Sampler(object): pass def _verify_external_sampler(self): - external_sampler_name = self.__class__.__name__ - print(external_sampler_name) + external_sampler_name = self.__class__.__name__.lower() try: self.external_sampler = __import__(external_sampler_name) - except (ImportError, SystemExit, ModuleNotFoundError): + except (ImportError, SystemExit): raise SamplerNotInstalledError( "Sampler {} is not installed on this system".format(external_sampler_name)) + def _verify_kwargs_against_default_kwargs(self): """ Check if the kwargs are contained in the list of available arguments diff --git a/bilby/core/sampler/emcee.py b/bilby/core/sampler/emcee.py index ba5b7033b..932462884 100644 --- a/bilby/core/sampler/emcee.py +++ b/bilby/core/sampler/emcee.py @@ -109,7 +109,6 @@ class Emcee(MCMCSampler): tqdm = get_progress_bar() sampler = emcee.EnsembleSampler(dim=self.ndim, lnpostfn=self.lnpostfn, **self.sampler_init_kwargs) self._set_pos0() - print(self.nsteps) for _ in tqdm(sampler.sample(p0=self.pos0, **self.sampler_function_kwargs), total=self.nsteps): pass -- GitLab