Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if ncpu > 1:
dyn_args = {'pool':mp.Pool(ncpu), 'queue_size':ncpu}
else:
dyn_args = {}
# Intercept kwargs that go into DynamicNestedSampler():
if 'loglikelihood' in kwargs:
loglike = kwargs.pop('loglikelihood')
else:
loglike = ms.Loglike(data, uncert, func, params, indparams, pstep)
if 'prior_transform' in kwargs:
prior_transform = kwargs.pop('prior_transform')
skip_logp = True
else:
prior_transform = ms.Prior_transform(prior, priorlow, priorup,
pmin, pmax, pstep)
skip_logp = False
if 'ndim' in kwargs:
nfree = kwargs.pop('ndim')
# Pop other DynamicNestedSampler() arguments from kwargs:
if sys.version_info.major == 3:
signature = inspect.signature(dynesty.DynamicNestedSampler).parameters
else:
signature = inspect.getcallargs(dynesty.DynamicNestedSampler,
None,None,None)
dyn_args_list = np.intersect1d(
list(signature.keys()),
list(kwargs.keys()))