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

Add doc strings and add npool to cpnest

parent 8890eb14
No related branches found
No related tags found
1 merge request!782Adds a pool to the reconstruction
Pipeline #125075 passed
......@@ -47,6 +47,11 @@ class Cpnest(NestedSampler):
for equiv in self.npoints_equiv_kwargs:
if equiv in kwargs:
kwargs['nlive'] = kwargs.pop(equiv)
if 'nthreads' not in kwargs:
for equiv in self.npool_equiv_kwargs:
if equiv in kwargs:
kwargs['nthreads'] = kwargs.pop(equiv)
if 'seed' not in kwargs:
logger.warning('No seed provided, cpnest will use 1234.')
......
......@@ -778,6 +778,9 @@ def generate_all_bns_parameters(sample, likelihood=None, priors=None, npool=1):
likelihood.interferometers.
priors: dict, optional
Dictionary of prior objects, used to fill in non-sampled parameters.
npool: int, (default=1)
If given, perform generation (where possible) using a multiprocessing pool
"""
waveform_defaults = {
'reference_frequency': 50.0, 'waveform_approximant': 'TaylorF2',
......@@ -1087,6 +1090,8 @@ def generate_posterior_samples_from_marginalized_likelihood(
Posterior from run with a marginalised likelihood.
likelihood: bilby.gw.likelihood.GravitationalWaveTransient
Likelihood used during sampling.
npool: int, (default=1)
If given, perform generation (where possible) using a multiprocessing pool
Return
------
......@@ -1127,5 +1132,6 @@ def generate_posterior_samples_from_marginalized_likelihood(
def fill_sample(args):
ii, sample, likelihood = args
sample = dict(sample).copy()
likelihood.parameters.update(dict(sample).copy())
new_sample = likelihood.generate_posterior_sample_from_marginalized_likelihood()
return new_sample["geocent_time"], new_sample["luminosity_distance"], new_sample["phase"]
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