Page 1 of 1

Cobaya/Classy: can't drop theta_s_1e2 (100*theta_s)

Posted: May 09 2022
by Natalie Assmann
Dear all,

I am trying to not sample directly the cosmological parameters, but deriving them by sampled ones (lets just call them alpha_i). For most of the parameters this is not a big deal, but I got issues with '100*theta_s'.
I'm using Cobaya with classy. As input basis I use a info.yaml containing (among other things) the following part (this is directly taken from the class example on the Cobaya webpage):

Code: Select all

      min: 0.5
      max: 10
      dist: norm
      loc: 1.0416
      scale: 0.0004
    proposal: 0.0002
    latex: 100\theta_\mathrm{s}
    drop: true
    value: 'lambda theta_s_1e2: theta_s_1e2'
    derived: false

Now I want to add and override stuff from the info.yaml in a python file like this:
This is an example of one of the sampled alpha parameters:

Code: Select all

info["params"]["alpha1"] = {"prior": {"min": alpha_prior[0][0], "max": alpha_prior[0][1]}, "ref": ref_list[0], "proposal": 0.01, "drop": True, "latex": r"\alpha_1"}
And this is how I would like to derive the '100*theta_s' parameter:

Code: Select all

info["params"]["theta_s_1e2"] = {"value": lambda alpha1, ... : some function depending on alpha , "min": 0.5, "max": 10, "latex": r"100\theta_\mathrm{s}", "proposal": 0.0002, "drop": True}
The Problem with this is that classy then takes "theta_s_1e2" as a direkt input parameter (additional to 100*theta_s) and is not able to drop it (as I understood one can only drop sampled parameters). It raises the following error message:

Code: Select all

File "classy.pyx", line 366, in classy.Class.compute
Error in Class: Class did not read input parameter(s): theta_s_1e2

Since "theta_s_1e2" is exactly the same value as "100*theta_s" it would be nice to just directly define the "100*theta_s" instead of taking this step in between. But this is not possible since "100*theta_s" is not a valid python variable name.

Is there any way around this problem?

Please let me know if you need any additional information to answer my question.
Thanks in advance!


Re: Cobaya/Classy: can't drop theta_s_1e2 (100*theta_s)

Posted: May 19 2022
by Natalie Assmann
Hi guys,
this problem could be resolved and maybe there will be a corresponding PR to the devel repo of CLASS by the guy who helped me out.