Page 1 of 1

Calculating sigma8 in cobaya

Posted: November 12 2019
by Alex Krolewski
I'm using cobaya to sample over As and would like to additionally output sigma8 in my chains. But I'm having some difficulty doing this. I tried "get_sigma8" in pycamb as in boxes 8 and 9 here:

https://camb.readthedocs.io/en/latest/CAMBdemo.html

Running the following code:

model = get_model(info)
theory = model.likelihood.theory
pars = theory.camb.CAMBparams()
theory.camb.get_results(pars)

I got CAMBValueError: Parameter values not set on the last line.

Is there perhaps another method to get sigma8?

Re: Calculating sigma8 in cobaya

Posted: November 12 2019
by Omar Darwish
To put sigma8 in your chains you just add it as a derived parameter in the info dictionary:

params = odict([
["logAs", {"prior": {"min": lnAs_min, "max": lnAs_max}, "ref": {"dist": "norm", "loc": lnAs_central, "scale": 1.67162852e-02}, "proposal": 1.67162852e-02}],.......
["As", {"value": lambda logAs: 1e-10*np.exp(logAs), "latex": r"A_s"}],
["sigma8", {"derived": True, "latex": r"\sigma_8"}]])

(....... represents other parameters you want to put)

Then in the info:

info = {
"likelihood": .....,
"theory": {"camb": {"extra_args": {"accurate_massive_neutrino_transfers": True, "redshifts": [0.], "nonlinear": True, "kmax": 10., "dark_energy_model": "ppf", "WantTransfer": True}}},
"params": params,
"sampler": {"evaluate": {None}}, #{"mcmc": {"burn_in": 100, "max_samples": 20000, "max_tries": 400, "learn_proposal": True, "covmat": chains_dir+starting_covmat}},
"timing": True,
"resume": True,
#"debug": True,
"output": .....}


where "redshifts" are the redshifts where you want to calculate sigma8.

This is how I've done it. I do not know if there are other ways, but from what I understood cobaya developers want to you use the functions that they give you to get parameters, without accessing specific attributes of the theory.

Let me know if it is not clear!

Re: Calculating sigma8 in cobaya

Posted: November 19 2019
by Alex Krolewski
Thank you, this solved my problem!