Quantcast
Channel: CosmoCoffee
Viewing all articles
Browse latest Browse all 185

Computers and software • COBAYA: Issue with passing parameters values from config file

$
0
0
Hi everyone,

I'm trying to make my own likelihood class in Cobaya. However, I'm struggling with nuisance parameters. To make everything more clear, I'll make a simple example. Let's say this is the code for my likelihood class:

Code:

from cobaya.likelihood import Likelihoodimport numpy as npclass MyLikelihood(Likelihood):    def initialize(self):        # No external data files needed for this example        pass    def get_requirements(self):        # No specific requirements for this simple example        return {}    def logp(self, **params_values):        # Access the nuisance parameters        print(params_values)        my_foreground_amp = params_values['my_foreground_amp']        another_nuisance_param = params_values['another_nuisance_param']        H0 = params_values['H0']                model_value = 70 + my_foreground_amp * 0.01 + another_nuisance_param * 0.1        observed_value = 70          chi2 = (observed_value - model_value) ** 2 / 2.0         return -chi2 / 2
And this is the .yaml file in which the nuisance parameters are defined:

Code:

likelihood:  mylikelihood.MyLikelihood:    params:  my_foreground_amp:    prior:      dist: uniform      min: 0      max: 100    proposal: 27    latex: A^{f}_{\rm{mine}}  another_nuisance_param:    prior:      dist: norm      loc: 1      scale: 0.1    proposal: 0.01    latex: \theta_{\rm{nuisance}}  H0:    prior:      dist: norm      loc: 70      scale: 2    proposal: 0.5    latex: H_0sampler:  mcmc:    max_tries: 1000
However, when I try to run cobaya with this setup, I always get an error of this form:
Could not find anything to use input parameter(s) {'another_nuisance_param', 'my_foreground_amp', 'H0'}
stating that the nuisance parameters are not used in any likelihood or theory code. How do I fix this?

Thanks in advance for the help,

Gabriele Autieri

Statistics: Posted by Gabriele Autieri — August 06 2024



Viewing all articles
Browse latest Browse all 185

Trending Articles