montepython_public
montepython_public copied to clipboard
Issue with n_dims when running MontePython with MultiNest
Hi, When running MontePython with MultiNest, there seems to be a compiler-dependent issue with the handling of the n_dims variable when it is passed between pyMultiNest and MultiNest. The value of n_dims is correctly initialised, but becomes random when it is passed later as an argument of the functions prior() and loglike().
As a temporary fix for this, one can hard-code the value of n_dims in the functions prior() and loglike() in the nested_sampling.py file, but this needs to be done for every run. Here is an example of our hard-coded fix assuming 6 parameters (what matters here is the dimension of the free parameter space, cosmological+nuisance; derived parameters do not count): between
def prior(cube, ndim, *args):
and the loop
for i, name in zip(range(ndim), NS_param_names):
cube[i] = data.mcmc_parameters[name]['prior']\
.map_from_unit_interval(cube[i])
we added the line
ndim=6
and the same just after
def loglike(cube, ndim, *args):
An issue has been opened about this in the pyMultiNest git as well (https://github.com/JohannesBuchner/PyMultiNest/issues/72).