Cobaya: creating an external theory class
Posted: February 21 2020
Are there any examples in the documentation of using your own external theory class?
I am trying to create a basic theory class to use with the Planck low-ell EE likelihood. Based on the docstring in external.py ("Just pass an instance of a class through the parameter ``instance``, containing the necessary methods for the likelihood to retrieve observables.") I have used the following input for the likelihood and theory:
I then try to create a model:
but I get the error
My method 'needs' does take Cl (I have also tried it with the more general **requirements in a similar way to what is done in _cosmo), so my best guess that theory is somehow set to the wrong class (possibly the superclass Theory, where needs takes 'arguments') to cause this error.
What is the right way to set up a Cobaya model with my external theory class?
Thanks!
I am trying to create a basic theory class to use with the Planck low-ell EE likelihood. Based on the docstring in external.py ("Just pass an instance of a class through the parameter ``instance``, containing the necessary methods for the likelihood to retrieve observables.") I have used the following input for the likelihood and theory:
Code: Select all
info_txt = r"""
likelihood:
planck_2018_lowl.EE:
theory:
external:
instance: instance_of_my_theory_class
...
info = yaml_load(info_txt)
info['modules'] = '/Users/heatherp/cobaya-cosmo'
Code: Select all
model = get_model(info)
Code: Select all
~/.local/lib/python3.6/site-packages/cobaya/likelihoods/_base_classes/_planck_clik_prototype.py in add_theory(self)
--> 126 self.theory.needs(Cl=dict(zip(self.requested_cls, self.l_maxs_cls)))
TypeError: needs() got an unexpected keyword argument 'Cl'
What is the right way to set up a Cobaya model with my external theory class?
Thanks!