Cobaya run test failed : path for clik and Planck likelihood

Use of Cobaya. camb, CLASS, cosmomc, compilers, etc.
Post Reply
Dournac Fabien
Posts: 68
Joined: May 18 2019
Affiliation: IRAP
Contact:

Cobaya run test failed : path for clik and Planck likelihood

Post by Dournac Fabien » April 02 2022

Hello,

I have installed a few time ago CosmoMC with Planck Likelihoods 2018 from PLA and I wonder if I could use these data for Cobaya, i.e
without reinstalling CAMB, CLASS and Likelihoods with the environment variable $PLANCK_2018_DATA (I have done a global installation : import camb, import classy work from anywhere ).

For the moment, I have an issue to make run a simple test with Cobaya.

Here is the input file used (
cosmo.yaml
) :

Code: Select all

theory:
  camb:
    extra_args:
      halofit_version: mead
      bbn_predictor: PArthENoPE_880.2_standard.dat
      lens_potential_accuracy: 1
      num_massive_neutrinos: 1
      nnu: 3.046
      theta_H0_range:
      - 20
      - 100
likelihood:
  planck_2018_lowl.TT: null
  planck_2018_lowl.EE: null
  planck_2018_highl_plik.TTTEEE: null
  planck_2018_lensing.clik: 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
  cosmomc_theta:
    value: 'lambda theta_MC_100: 1.e-2*theta_MC_100'
    derived: false
  H0:
    latex: H_0
    min: 20
    max: 100
  ombh2:
    prior:
      min: 0.005
      max: 0.1
    ref:
      dist: norm
      loc: 0.0224
      scale: 0.0001
    proposal: 0.0001
    latex: \Omega_\mathrm{b} h^2
  omch2:
    prior:
      min: 0.001
      max: 0.99
    ref:
      dist: norm
      loc: 0.12
      scale: 0.001
    proposal: 0.0005
    latex: \Omega_\mathrm{c} h^2
  omegam:
    latex: \Omega_\mathrm{m}
  omegamh2:
    derived: 'lambda omegam, H0: omegam*(H0/100)**2'
    latex: \Omega_\mathrm{m} h^2
  mnu: 0.06
  omega_de:
    latex: \Omega_\Lambda
  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}
  tau:
    prior:
      min: 0.01
      max: 0.8
    ref:
      dist: norm
      loc: 0.055
      scale: 0.006
    proposal: 0.003
    latex: \tau_\mathrm{reio}
  zrei:
    latex: z_\mathrm{re}
  sigma8:
    latex: \sigma_8
  s8h5:
    derived: 'lambda sigma8, H0: sigma8*(H0*1e-2)**(-0.5)'
    latex: \sigma_8/h^{0.5}
  s8omegamp5:
    derived: 'lambda sigma8, omegam: sigma8*omegam**0.5'
    latex: \sigma_8 \Omega_\mathrm{m}^{0.5}
  s8omegamp25:
    derived: 'lambda sigma8, omegam: sigma8*omegam**0.25'
    latex: \sigma_8 \Omega_\mathrm{m}^{0.25}
  A:
    derived: 'lambda As: 1e9*As'
    latex: 10^9 A_\mathrm{s}
  clamp:
    derived: 'lambda As, tau: 1e9*As*np.exp(-2*tau)'
    latex: 10^9 A_\mathrm{s} e^{-2\tau}
  age:
    latex: '{\rm{Age}}/\mathrm{Gyr}'
  rdrag:
    latex: r_\mathrm{drag}
sampler:
  mcmc:
    drag: true
    oversample_power: 0.4
    proposal_scale: 1.9
    covmat: auto
    Rminus1_stop: 0.01
    Rminus1_cl_stop: 0.2
Unfortunately, I can't launch a run when I performe a :

$ cobaya-run cosmo.yaml -p /opt/intel/oneapi/intelpython/python3.7/lib/python3.7/site-packages/cobaya/likelihoods/

I get the following errors :

Code: Select all

[output] Output to be read-from/written-into folder '.', with prefix 'cosmo'
[output] Found existing info files with the requested output prefix: 'cosmo'
[prior] *WARNING* External prior 'SZ' loaded. Mind that it might not be normalized!
[CAMB] Importing *auto-installed* CAMB (but defaulting to *global*).
[camb] Initialized!
[clik] *ERROR* The given folder does not exist: '/opt/intel/oneapi/intelpython/python3.7/lib/python3.7/site-packages/cobaya/likelihoods/code/planck'
[planck_2018_lowl.tt] *ERROR* Could not find the 'clik' Planck likelihood code. Check error message above.
[exception handler] ---------------------------------------

Traceback (most recent call last):
  File "/opt/intel/oneapi/intelpython/python3.7/bin/cobaya-run", line 8, in <module>
    sys.exit(run_script())
  File "/opt/intel/oneapi/intelpython/python3.7/lib/python3.7/site-packages/cobaya/run.py", line 216, in run_script
    run(info, **arguments.__dict__)
  File "/opt/intel/oneapi/intelpython/python3.7/lib/python3.7/site-packages/cobaya/run.py", line 139, in run
    stop_at_error=info.get("stop_at_error", False)) as model:
  File "/opt/intel/oneapi/intelpython/python3.7/lib/python3.7/site-packages/cobaya/model.py", line 153, in __init__
    packages_path=packages_path, timing=timing)
  File "/opt/intel/oneapi/intelpython/python3.7/lib/python3.7/site-packages/cobaya/likelihood.py", line 300, in __init__
    name=name))
  File "/opt/intel/oneapi/intelpython/python3.7/lib/python3.7/site-packages/cobaya/likelihood.py", line 92, in __init__
    standalone=standalone)
  File "/opt/intel/oneapi/intelpython/python3.7/lib/python3.7/site-packages/cobaya/theory.py", line 67, in __init__
    standalone=standalone)
  File "/opt/intel/oneapi/intelpython/python3.7/lib/python3.7/site-packages/cobaya/component.py", line 95, in __init__
    self.initialize()
  File "/opt/intel/oneapi/intelpython/python3.7/lib/python3.7/site-packages/cobaya/likelihoods/base_classes/planck_clik.py", line 59, in initialize
    self.log, "Could not find the 'clik' Planck likelihood code. "
cobaya.install.NotInstalledError: Could not find the 'clik' Planck likelihood code. Check error message above.
I have already installed Planck 2018 Likelihood with which variable
PLANCK_2018_DATA
is equal to :

Code: Select all

$ echo $PLANCK_2018_DATA 

/home/fab/baseline/plc_3.0
The main error seems to be :

Code: Select all

[clik] *ERROR* The given folder does not exist: '/opt/intel/oneapi/intelpython/python3.7/lib/python3.7/site-packages/cobaya/likelihoods/planck_2018_highl_plik/code/planck'
and I don't know how to fix it ( under Python shell,

Code: Select all

import clik
is working fine) : which is the command line to apply with option -p of binary cobaya-run ?

Maybe there is a way to indicate to cobaya where are the PLANCK Likelihoods from my previous installation of CosmoMC ?

Any suggestion is welcome.

Regards

Juan Cruz
Posts: 5
Joined: January 24 2022
Affiliation: University of Southern Denmark - SDU

Re: Cobaya run test failed : path for clik and Planck likelihood

Post by Juan Cruz » May 06 2022

Instead of having them with Cobaya's default options, add the necessary paths to your installation of clik and planck data as follows

Code: Select all

likelihood:
  planck_2018_lowl.TT:
  	path: /your path to clik/
  	clik_file: /path to the corresponding .clik folder
 
You can do the same thing with CAMB and add the path in the yaml file in the CAMB section, then Cobaya looks for them and initializes them correctly.

Post Reply