Saving Cls and mpk from cobaya
-
- Posts: 28
- Joined: November 14 2005
- Affiliation: Swarthmore
- Contact:
Saving Cls and mpk from cobaya
I am interested in running cobaya with a specific set of cosmological parameters and having it save the Cls and matter power spectrum. Is there a quick way to do this?
-
- Posts: 28
- Joined: November 14 2005
- Affiliation: Swarthmore
- Contact:
Re: Saving Cls and mpk from cobaya
After poking around a bit, I found a way to do this:
Code: Select all
import cobaya
import numpy as np
from cobaya.yaml import yaml_load
from cobaya.model import get_model
yaml_file='./XXX.yaml' #your yaml file
info = yaml_load(yaml_file)
model = get_model(info)
point = dict(zip(model.parameterization.sampled_params(),model.prior.sample(ignore_external=True)[0]))
logposterior = model.logposterior(point, as_dict=True)
Cls = model.provider.get_Cl(ell_factor=True)
np.savez('Cls.npz', Cls)
-
- Posts: 28
- Joined: November 14 2005
- Affiliation: Swarthmore
- Contact:
Re: Saving Cls and mpk from cobaya
and I forgot to add that I put
in my yaml file.
Code: Select all
sampler:
evaluate: