Hello,
I am afraid the tabulated w(a) cannot be directly used in Cobaya with the current implementation of CAMB. When the dark energy module is set up, w is expected to be a float, which is the reason why you get the error. If you want to use the tabulated w(a) with Cobaya, you would need to modify the code. One way of doing that is by adding two arrays a and w in argument of the set_params function of dark_energy.py and then to modify that function in order to call the set_w_a_table function.
After having implemented those modifications, you will be able to use the a and w arrays in the yaml file you give to Cobaya. If your w array depends on one x sampled parameter, you should use the vector parameters approach: https://cobaya.readthedocs.io/en/latest/params_prior.html#vector-parameters. This is in any case needed, as Cobaya can only sample scalars.
The only advantage I can think of, running Cobaya from a Python interpreter is when you want to use the model object (https://cobaya.readthedocs.io/en/latest/models.html) to interact with the sampler, but there could have others.
Ultimately, you can find guidelines on modifying CAMB here: https://camb.readthedocs.io/en/latest/modifying_code.html. Those guidelines should help you modifying both the python and fortran codes.
I hope this helps and answers most of your questions.
I am afraid the tabulated w(a) cannot be directly used in Cobaya with the current implementation of CAMB. When the dark energy module is set up, w is expected to be a float, which is the reason why you get the error. If you want to use the tabulated w(a) with Cobaya, you would need to modify the code. One way of doing that is by adding two arrays a and w in argument of the set_params function of dark_energy.py and then to modify that function in order to call the set_w_a_table function.
After having implemented those modifications, you will be able to use the a and w arrays in the yaml file you give to Cobaya. If your w array depends on one x sampled parameter, you should use the vector parameters approach: https://cobaya.readthedocs.io/en/latest/params_prior.html#vector-parameters. This is in any case needed, as Cobaya can only sample scalars.
The only advantage I can think of, running Cobaya from a Python interpreter is when you want to use the model object (https://cobaya.readthedocs.io/en/latest/models.html) to interact with the sampler, but there could have others.
Ultimately, you can find guidelines on modifying CAMB here: https://camb.readthedocs.io/en/latest/modifying_code.html. Those guidelines should help you modifying both the python and fortran codes.
I hope this helps and answers most of your questions.
Statistics: Posted by Raphael Kou — June 03 2024