According to the section "Modifying CAMB" (https://cobaya.readthedocs.io/en/latest/theory_camb.html?#modifying-camb) in cobaya.readthedocs we can use CAMBParamRangeError, or simply CAMBError to assign a zero likelihood when the computation of any observable would fail. In my case the observable is omega_de and the fail is omega_de<0 and the MCMC chain stop when this occurs. Therefore, to use this Cobaya functionality, what I did was to put CAMBError in the function set_params in the python module results.py. The modified results.py is
Code: Select all
def set_params(self, params):
"""
Set parameters from params. Note that this does not recompute anything;
you will need to call :meth:`calc_transfers` if you change any parameters affecting the
background cosmology or the transfer function settings.
:param params: a :class:`~.model.CAMBparams` instance
"""
self.Params = params
if (self.omega_de < 0):
raise CAMBError('omega dark energy is negative, assigning 0 likelihood')
Thank you very much.