CobayaSampler / cobaya

Code for Bayesian Analysis
http://cobaya.readthedocs.io/en/latest/
Other
122 stars 125 forks source link

Error with the .yaml file generated from cosmo generator #364

Open prakharbansal16 opened 2 weeks ago

prakharbansal16 commented 2 weeks ago

I'm trying to use the DESI BAO data along with the \theta_* (sound horizon at recombination) to obtain constraints on omega_m and H for w0waCDM model. I generated the relevant input file using cosmo generator. Here is the .yaml file

theory:
  camb:
    extra_args:
      dark_energy_model: ppf
      num_massive_neutrinos: 1
      nnu: 3.044
      theta_H0_range:
      - 20
      - 100
likelihood:
  bao.desi_2024_bao_all: null
params:
  logA:
    prior:
      min: 1.61
      max: 3.91
    ref:
      dist: norm
      loc: 3.05
      scale: 0.001
    proposal: 0.001
    latex: \log(10^{10} A_\mathrm{s})
    drop: true
  As:
    value: 'lambda logA: 1e-10*np.exp(logA)'
    latex: A_\mathrm{s}
  ns:
    prior:
      min: 0.8
      max: 1.2
    ref:
      dist: norm
      loc: 0.965
      scale: 0.004
    proposal: 0.002
    latex: n_\mathrm{s}
  theta_MC_100:
    prior:
      min: 0.5
      max: 10
    ref:
      dist: norm
      loc: 1.04109
      scale: 0.0004
    proposal: 0.0002
    latex: 100\theta_\mathrm{MC}
    drop: true
    renames: theta

  H0:
    latex: H_0
    min: 20
    max: 100
  omegab:
    prior:
      min: 0.03
      max: 0.07
    ref:
      dist: norm
      loc: 0.0495
      scale: 0.004
    proposal: 0.004
    latex: \Omega_\mathrm{b}
    drop: true
  omegam:
    prior:
      min: 0.1
      max: 0.9
    ref:
      dist: norm
      loc: 0.316
      scale: 0.02
    proposal: 0.02
    latex: \Omega_\mathrm{m}
    drop: true
  ombh2:
    value: 'lambda omegab, H0: omegab*(H0/100)**2'
    latex: \Omega_\mathrm{b} h^2
  omch2:
    value: 'lambda omegam, omegab, mnu, H0: (omegam-omegab)*(H0/100)**2-(mnu*(3.044/3)**0.75)/94.0708'
    latex: \Omega_\mathrm{c} h^2
  omegamh2:
    derived: 'lambda omegam, H0: omegam*(H0/100)**2'
    latex: \Omega_\mathrm{m} h^2
  mnu: 0.06
  w:
    prior:
      min: -3
      max: 1
    ref:
      dist: norm
      loc: -0.99
      scale: 0.02
    proposal: 0.02
    latex: w_{0,\mathrm{DE}}
  wa:
    prior:
      min: -3
      max: 2
    ref:
      dist: norm
      loc: 0
      scale: 0.05
    proposal: 0.05
    latex: w_{a,\mathrm{DE}}
  YHe:
    latex: Y_\mathrm{P}
  Y_p:
    latex: Y_P^\mathrm{BBN}
  DHBBN:
    derived: 'lambda DH: 10**5*DH'
    latex: 10^5 \mathrm{D}/\mathrm{H}
sampler:
  mcmc:
    covmat: auto

When I run the file, I get an error message

[parameterization] ERROR Input parameters defined as functions can only depend on other input parameters. In particular, an input parameter cannot depend on ['H0']. Use an explicit Theory calculator for more complex dependencies. If you intended to define a derived output parameter use derived: instead of value:

In cosmo generator I had set the parameter "Hubble parameter constraint" as "angular size of sound horizon at recombination". What can be a possible fix for the above problem

cmbant commented 2 weeks ago

The message looks correct, if sampling thetastar you need to also sample omch2, ombh2 as H0 is not known a priori. If you are just using DESI data, there doesn't seem to be a strong reason not to just sample H0 and get thetastar as a derived parameter? (and if you want to impose a prior on thetastar cf https://github.com/CobayaSampler/cobaya/issues/18)

cmbant commented 2 weeks ago

(@JesusTorrado perhaps we should add an example for priors on theory-derived to the doc somewhere, not sure it's explicitly covered?)