Yep. I didn't realise there was already a built-in solution. Here's an example with neutrino masses taken from the cobaya github (where I raised this issue
also) by Lukas Hergt:
Code: Select all
value: 'lambda m1, m2, m3: str(m1) + "," + str(m2) + "," + str(m3)'
Note that the "drop"s are important otherwise class will try (and fail) to read your parameters m1, m2, m3 and the cobaya run will fail.
The "derived: false" tells cobaya that the parameter needs to be passed to class (although I expect derived: false should be the default anyway).
The link to the issue also includes my code to modify cobaya if you'd prefer to pass parameters as in MontePython, with m__1, m__2, m__3 and so on. The code then internally parses it to match class input. I prefer the solution above more than my own code though.
Hope that helps!