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: Select all
from cobaya.likelihood import Likelihood
import numpy as np
class 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
Code: Select all
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_0
sampler:
mcmc:
max_tries: 1000
stating that the nuisance parameters are not used in any likelihood or theory code. How do I fix this?Could not find anything to use input parameter(s) {'another_nuisance_param', 'my_foreground_amp', 'H0'}
Thanks in advance for the help,
Gabriele Autieri