baudren / montepython_public

Public repository for the Monte Python Code
MIT License
65 stars 115 forks source link

Adding an extra model parameter in MontePython/Class #88

Closed pchaubal closed 7 years ago

pchaubal commented 7 years ago

Hi everyone. I am quite new to MontePython so some help would be greatly appreciated. I am working on some model which requires an extra parameter besides the 6 standard cosmology parameter. Right now the parameter is arbitrarily put by hand in the perturbations.c module of Class and I am getting expected results. How do I modify MontePython and Class such that I can run Montepython with this new 6+1 parameter model? Thanks in advance for any help.

brinckmann commented 7 years ago

Hi, You need to add your parameter to the class python wrapper. To do that, have a look at how other similar parameters are implemented. Once you have added it to the wrapper you are done. Just add your parameter to your param file, as with any other varying cosmological parameter. Good luck! Thejs

miguelzuma commented 7 years ago

Right now the parameter is arbitrarily put by hand in the perturbations.c module

You will have to define a new parameter in perturbations.h and modify input.c to have CLASS read the parameter (look at any other class parameter by typing grep your_parameter */*.* in the terminal). This way you can pass the parameter in the input file you give CLASS. Most importantly, you don't need to compile the code every time you want to change your parameter.

After you do this you don't need to change anything in the python wrapper. Once CLASS reads it from the ini file you can pass it as any other MontePython cosmological parameter.

pchaubal commented 7 years ago

Thanks a lot for a quick response. We added the parameter and the code is producing chains.