brinckmann / montepython_public

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

Matching parameters for multiple models #335

Closed TonyZhou729 closed 1 year ago

TonyZhou729 commented 1 year ago

Hi,

I'm looking to compare two models and plot their posteriors on the same triangle plot. I know how to customize the parameter names and definitions via the --extra file for one given model, but I'm not sure how to do this for two models with different parameters.

The scenario I have is this. I'm trying to derive a common parameter A for both models and plot its posteriors. Model 1 derives A via parameters B and C (which only model 1 has) and model 2 derives it via parameters D and E (which only model 2 has). Trying to do both within one --extra file throws an error whenever one model looks for a parameter only the other has, and I haven't been able to pass in two --extra files. Is there a good strategy for something like this?

Thank you for your help. Tony

TonyZhou729 commented 1 year ago

One working solution is to use info.to_change for one parameter from each model to the parameter A, then use info.redefine on the original parameter with the formula for A instead of using info.to_derive. Both info.to_change and info.redefine first check that the parameter is part of the model (checks if it is in info.backup_names, which stores the parameter names in log.param) before making any changes, so there won't be any conflicts for multiple models.