Skip to content
Snippets Groups Projects
Commit 1b6feabb authored by Gregory Ashton's avatar Gregory Ashton
Browse files

Fix threads=1 behaviour

parent 6e6f3770
No related branches found
No related tags found
1 merge request!750Improve ptemcee
Pipeline #113469 failed
......@@ -167,13 +167,17 @@ class Ptemcee(MCMCSampler):
else:
# Initialize the PTSampler
self.sampler = ptemcee.Sampler(
dim=self.ndim, logl=do_nothing_function, logp=do_nothing_function,
pool=self.pool, threads=self.threads, **self.sampler_init_kwargs)
if self.threads == 1:
self.sampler = ptemcee.Sampler(
dim=self.ndim, logl=self.log_likelihood, logp=self.log_prior,
**self.sampler_init_kwargs)
else:
self.sampler = ptemcee.Sampler(
dim=self.ndim, logl=do_nothing_function, logp=do_nothing_function,
pool=self.pool, threads=self.threads, **self.sampler_init_kwargs)
# Overwrite the _likeprior to improve performance with threads > 1
self.sampler._likeprior = LikePriorEvaluator(
self.search_parameter_keys, use_ratio=self.use_ratio)
self.sampler._likeprior = LikePriorEvaluator(
self.search_parameter_keys, use_ratio=self.use_ratio)
# Set up empty lists
self.tau_list = []
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment