run_likelihoods module

Contains functions to run likelihood modules.

run_likelihoods.max_like_1d(theory_filemask, obs_filemask, varied_param, save_dir, batch_size, n_zbin, fid_dir, pos_subdir, she_subdir, pos_she_subdir, ell_filename, pos_nl_path, she_nl_path, noise_ell_path, lmax, lmin)

Run Wishart and Gaussian likelihoods for a single parameter repeatedly for many observations, and save a text file with the maximum likelihood parameter values.

Designed to process output from simulation.sim_cls_fullsky.

Parameters
  • theory_filemask (str) – Filemask for subdirectories of a 1D CosmoSIS output grid to iterate over.

  • obs_filemask (str) – Filemask for observations to iterate over.

  • varied_param (str) – Name of the parameter being varied, as it appears in the cosmological_parameters/values.txt file.

  • save_dir (str) – Path to directory to save output to.

  • batch_size (int) – Number of observations per batch, where one text file is output per batch.

  • n_zbin (int) – Number of redshift bins.

  • fid_dir (str) – Path to directory containing fiducial power spectra, for Gaussian covariance.

  • pos_subdir (str) – Name of the sub-directory containing position-position power spectra.

  • she_subdir (str) – Name of the sub-directory containing shear-shear power spectra.

  • pos_she_subdir (str) – Name of the sub-directory containing position-shear power spectra.

  • ell_filename (str) – Filename containing ells within each sub-directory.

  • pos_nl_path (str) – Path to position noise power spectrum.

  • she_nl_path (str) – Path to shear noise power spectrum.

  • noise_ell_path (str) – Path to noise ells.

  • lmax (int) – Maximum ell for likelihood.

  • lmin (int) – Minimum ell for likelihood.

run_likelihoods.post_mean_std_1d(theory_filemask, obs_filemask, varied_param, save_dir, batch_size, n_zbin, fid_dir, pos_subdir, she_subdir, pos_she_subdir, ell_filename, pos_nl_path, she_nl_path, noise_ell_path, lmax, lmin)

Run Wishart and Gaussian likelihoods for a single parameter repeatedly for many observations, and save a text file with the posterior mean and standard deviation for each observation.

Designed to process output from simulation.sim_cls_fullsky.

Parameters
  • theory_filemask (str) – Filemask for subdirectories of a 1D CosmoSIS output grid to iterate over.

  • obs_filemask (str) – Filemask for observations to iterate over.

  • varied_param (str) – Name of the parameter being varied, as it appears in the cosmological_parameters/values.txt file.

  • save_dir (str) – Path to directory to save output to.

  • batch_size (int) – Number of observations per batch, where one text file is output per batch.

  • n_zbin (int) – Number of redshift bins.

  • fid_dir (str) – Path to directory containing fiducial power spectra, for Gaussian covariance.

  • pos_subdir (str) – Name of the sub-directory containing position-position power spectra.

  • she_subdir (str) – Name of the sub-directory containing shear-shear power spectra.

  • pos_she_subdir (str) – Name of the sub-directory containing position-shear power spectra.

  • ell_filename (str) – Filename containing ells within each sub-directory.

  • pos_nl_path (str) – Path to position noise power spectrum.

  • she_nl_path (str) – Path to shear noise power spectrum.

  • noise_ell_path (str) – Path to noise ells.

  • lmax (int) – Maximum ell for likelihood.

  • lmin (int) – Minimum ell for likelihood.

run_likelihoods.run_like_cl_gauss(grid_dir, varied_params, save_path, n_zbin, obs_pos_pos_dir, obs_she_she_dir, obs_pos_she_dir, pos_nl_path, she_nl_path, noise_ell_path, fid_pos_pos_dir, fid_she_she_dir, fid_pos_she_dir, lmax, leff_path=None)

Evaluate Gaussian likelhood on a CosmoSIS output grid and save the result as a text file.

Parameters
  • grid_dir (str) – Path to CosmoSIS grid.

  • varied_params (list) – List of varied parameter names as they appear in the cosmological_parameters/values.txt file.

  • save_path (str) – Path to save output to.

  • n_zbin (int) – Number of redshift bins. It will be assumed that there is one position field and one shear field per redshift bin.

  • obs_pos_pos_dir (str) – Path to the directory containing the observed position-position power spectra.

  • obs_she_she_dir (str) – Path to the directory containing the observed shear-shear power spectra.

  • obs_pos_she_dir (str) – Path to the directory containing the observed position-shear power spectra.

  • pos_nl_path (str) – Path to the position noise power spectrum.

  • she_nl_path (str) – Path to the shear noise power spectrum.

  • noise_ell_path (str) – Path to the file containing the ells for the noise power spectra.

  • fid_pos_pos_dir (str) – Path to the directory containing the fiducial theory position-position power spectra, used for the covariance.

  • fid_she_she_dir (str) – Path to the directory containing the fiducial theory shear-shear power spectra.

  • fid_pos_she_dir (str) – Path to the directory containing the fiducial theory position-shear power spectra.

  • lmax (int) – Maximum l to use in the likelihood.

  • leff_path (str, optional) – Path to ell-ell_effective mapping, to replace each l with its corresponding l_eff when calculating the covariance.

run_likelihoods.run_like_cl_wishart(grid_dir, varied_params, save_path, n_zbin, obs_pos_pos_dir, obs_she_she_dir, obs_pos_she_dir, pos_nl_path, she_nl_path, noise_ell_path, lmax, leff_path=None)

Evaluate Wishart likelhood on a CosmoSIS output grid and save the result as a text file.

Parameters
  • grid_dir (str) – Path to CosmoSIS grid.

  • varied_params (list) – List of varied parameter names as they appear in the cosmological_parameters/values.txt file.

  • save_path (str) – Path to save output to.

  • n_zbin (int) – Number of redshift bins. It will be assumed that there is one position field and one shear field per redshift bin.

  • obs_pos_pos_dir (str) – Path to the directory containing the observed position-position power spectra.

  • obs_she_she_dir (str) – Path to the directory containing the observed shear-shear power spectra.

  • obs_pos_she_dir (str) – Path to the directory containing the observed position-shear power spectra.

  • pos_nl_path (str) – Path to the position noise power spectrum.

  • she_nl_path (str) – Path to the shear noise power spectrum.

  • noise_ell_path (str) – Path to the file containing the ells for the noise power spectra.

  • lmax (int) – Maximum l to use in the likelihood.

  • leff_path (str, optional) – Path to ell-ell_effective mapping, to replace each l with its corresponding l_eff when calculating the covariance.

run_likelihoods.run_likes_cl_wishart_gauss(grid_dir, varied_params, save_path, n_zbin, obs_pos_pos_dir, obs_she_she_dir, obs_pos_she_dir, pos_nl_path, she_nl_path, noise_ell_path, fid_pos_pos_dir, fid_she_she_dir, fid_pos_she_dir, lmax, leff_path=None)

Evaluate both the Wishart and Gaussian likelhoods on a CosmoSIS output grid and save the result as a text file.

Parameters
  • grid_dir (str) – Path to CosmoSIS grid.

  • varied_params (list) – List of varied parameter names as they appear in the cosmological_parameters/values.txt file.

  • save_path (str) – Path to save output to.

  • n_zbin (int) – Number of redshift bins. It will be assumed that there is one position field and one shear field per redshift bin.

  • obs_pos_pos_dir (str) – Path to the directory containing the observed position-position power spectra.

  • obs_she_she_dir (str) – Path to the directory containing the observed shear-shear power spectra.

  • obs_pos_she_dir (str) – Path to the directory containing the observed position-shear power spectra.

  • pos_nl_path (str) – Path to the position noise power spectrum.

  • she_nl_path (str) – Path to the shear noise power spectrum.

  • noise_ell_path (str) – Path to the file containing the ells for the noise power spectra.

  • fid_pos_pos_dir (str) – Path to the directory containing the fiducial theory position-position power spectra, used for the covariance.

  • fid_she_she_dir (str) – Path to the directory containing the fiducial theory shear-shear power spectra.

  • fid_pos_she_dir (str) – Path to the directory containing the fiducial theory position-shear power spectra.

  • lmax (int) – Maximum l to use in the likelihood.

  • leff_path (str, optional) – Path to ell-ell_effective mapping, to replace each l with its corresponding l_eff when calculating the covariance.