I have written the following code for MCMC using EMCEE Python package
In the log_prior
function I defined the range of parameters to EMCEE moves between them not outside of them.
But the problem is, in the results I see that for instance od0
has the value like 0.64
which is not in 0.68 < od0 < 0.70
I have this problem even for b
.
I wonder how to force the EMCEE to be exactly between the ranges I defined.
The model is very sensitive to values and I just want to explore between 0.68 < od0 < 0.70
not bigger or smaller than this.
def log_prior(H0, od0, c, b, M):
if not 0.68 < od0 < 0.70 and 60 < H0 < 80 and -20 < M < -18.5 and 0.045 < b < 0.065 :
#return 0.0
return -np.inf
mu = 0.878
sigma = 0.0004
return np.log(1.0/(np.sqrt(2*np.pi)*sigma))-0.5*(c-mu)**2/sigma**2
without Gaussian prior
the code is:
def log_prior(H0, od0, c, b, M):
if 0.68 < od0 < 0.70 and 60 < H0 < 80 and -20 < M < -18.5 and 0.045 < b < 0.065 :
return 0.0
return -np.inf