brinckmann / montepython_public

Public repository for the Monte Python Code
MIT License
93 stars 80 forks source link

Flat prior on derived parameters #268

Closed LilleJohs closed 2 years ago

LilleJohs commented 2 years ago

Hi,

I want to have flat priors on the derived parameter Omega_Lambda, so that Omega_Lambda>0. I thought I could just do this data.parameters['Omega_Lambda'] = [1, 0 , None, 0, 1, 'derived'] where the first 0 is the lower bound.

That did not work and after reading the documentation, I am not sure if this is a bug or if the derived parameters do not support flat priors this way.

How do I add flat priors to derived parameters?

brinckmann commented 2 years ago

Hi,

As you already learned, MontePython ignores priors for the derived parameters. You'll have to add the condition yourself, this can be done in a variety of ways, see replies to issue #266 . If no CLASS errors outside of the allowed parameter space the easiest is to add a likelihood that improses the condition, returning a very large -loglkl value (e.g. 1e8) for rejected points or a 0 otherwise. If CLASS complains you instead have to follow the other instructions. You can access the parameter via cosmo.Omega_Lambda() .

Best, Thejs

LilleJohs commented 2 years ago

Great, thank you so much!