Best-fit point with hard bounds

Use of Healpix, camb, CLASS, cosmomc, compilers, etc.
Post Reply
Daniel Francisco Boriero
Posts: 16
Joined: March 09 2009
Affiliation: Bielefeld

Best-fit point with hard bounds

Post by Daniel Francisco Boriero » November 11 2015

Hello All,

By any chance, is there a modification you have to do in order to run the best-fit mode with a parameter having a hard bound? Like telling cosmomc that there is such parameter?

We included a diferent parameter for reionization and after five days, the best-fit mode couldn't converge.


Cosmo Xu
Posts: 7
Joined: March 19 2013
Affiliation: NJU/NAOC

Best-fit point with hard bounds

Post by Cosmo Xu » November 15 2015

If you know how the sampling parameters are used/organized inside cosmomc (I think this is the key point), you can add some stuff inside the likelihood function(s) which contains your new parameter: during each call of that likelihood function , you just need to check whether this parameter is outside your input hard bound. If true, you can just set the total chisq to a VERY LARGE value (i.e. 1E30), this will always make the 'new step' being rejected. Actually it might be better to check all hard bounds/priors before calling any likelihood functions, since if any parameter is outside the hard prior, there is no need to continue the calculations of likelihoods, this will save some computational time.

PS: recently I put a mcmc code on github (named "imcmc"), you can find it here:
You can try the testing samples contained there, and you will see that all sampling parameters have hard bounds (this is quite different from cosmomc), and if you want fix some parameter, then just remove the bound values (min,max). I think this might meet your needs. Besides I combined class and imcmc into a new code named "ClassMC", see:
but currently only planck2015 likelihoods are included (originally this is used as a test of imcmc, and new version is under development).

Antony Lewis
Posts: 1547
Joined: September 23 2004
Affiliation: University of Sussex

Re: Best-fit point with hard bounds

Post by Antony Lewis » November 19 2015

All base parameters have hard bounds by default, specified in the ini file as
param[p] = center MIN MAX width width
If it is a non-base parameter then you'd have to code a custom prior - e.g. see how the code does it for use_min_zre

Post Reply