thibautlouis / toy_likelihood

a simple cobaya likelihood
4 stars 0 forks source link

+TITLE: Toy likelihood for Simons Observatory

** Development mode If you plan to change things inside this code and/or to develop, you should first clone this repository or your personal fork with

+BEGIN_SRC shell

$ git clone https://github.com/thibautlouis/toy_likelihood.git /where/to/store/toy_likelihood

+END_SRC

You can install the =toy_likelihood= module in develop mode /i.e./

+BEGIN_SRC shell

$ pip install -e /where/to/store/toy_likelihood

+END_SRC

Then, you will be able to modify it directly without installing the code at every modification.

N.B. To avoid conflicts with global python modules such as global installation of =camb=, you can create a virtual environment to make sure your soft is properly encapsulated

+BEGIN_SRC shell

$ python3 -m venv /where/to/put/you/virtual/env

+END_SRC

After having loaded your new virtual env

+BEGIN_SRC shell

$ source /where/to/put/you/virtual/env/bin/activate

+END_SRC

you can install the code and its dependencies with the above =pip install -e= command and everything will be located in =/where/to/put/you/virtual/env=.

You can either run the =pslike.py= file by doing

+BEGIN_SRC shell

$ python /where/to/store/toy_likelihood/pslike/pslike.py [OPTIONS]

+END_SRC

or by using the =pslike= executable file. If you do so, you can get option parameters by typing

+BEGIN_SRC shell

$ pslike --help usage: pslike [-h] -y YAML_FILE [--debug] [--liketest] [--fisher] [--do-mcmc] [--get-input-spectra] [--use-fisher-covmat] [-i SIM_ID]

SO python likelihood

optional arguments:
  -h, --help            show this help message and exit
  -y YAML_FILE, --yaml-file YAML_FILE
                        Yaml file holding simulation/sampling setup
  --debug               Check chi2 with respect to input parameters
  --liketest            Check chi2 with respect to expected value
  --fisher              Print parameter standard deviations from Fisher
                        matrix
  --do-mcmc             Use MCMC sampler
  --get-input-spectra   Return input spectra corresponding to the sim
                        parameters
  --use-fisher-covmat   Use covariance matrix from Fisher calculation as
                        proposal
  -i SIM_ID, --sim-id SIM_ID
                        Simulation number

+END_SRC

The =yaml= files holds the simulation configuration and the =cobaya= sampling setup. An example, =global.yaml= is provided within the repository with the default \Lambda{}CDM parameters used in this analysis.

An interactive notebook can be accessed by following this link [[https://mybinder.org/v2/gh/thibautlouis/toy_likelihood/master?filepath=notebooks%2Fpslike_analysis.ipynb][https://mybinder.org/badge_logo.svg]]