loop_likelihood_nbin module
Functions to run likelihoods, automatically looping over numbers of angular bins.
- loop_likelihood_nbin.like_bp_gauss_loop_nbin(grid_dir, n_bps, n_zbin, lmax, lmin_like, lmin_in, fid_pos_pos_dir, fid_she_she_dir, fid_pos_she_dir, pos_nl_path, she_nl_path, noise_ell_path, pbl_save_dir, obs_bp_save_dir, inv_cov_save_dir, varied_params, like_save_dir, cov_fsky=1.0)
Run the like_bp_gauss likelihood module over a CosmoSIS grid repeatedly for different numbers of bandpowers, saving a separate likelihood file for each number of bandpowers.
- Parameters
grid_dir (str) – Path to CosmoSIS grid.
n_bps (list) – List of numbers of bandpowers.
n_zbin (int) – Number of redshift bins.
lmax (int) – Maximum l to use in the likelihood.
lmin_like (int) – Minimum l to use in the likelihood.
lmin_in (int) – Minimum l supplied in theory power spectra.
fid_pos_pos_dir (str) – Path to fiducial position-position power spectra.
fid_she_she_dir (str) – Path to fiducial shear-shear power spectra.
fid_pos_she_dir (str) – Path to fiducial position-shear power spectra.
pos_nl_path (str) – Path to text file containing position noise power spectrum.
she_nl_path (str) – Path to text file containing shear noise power spectrum.
noise_ell_path (str) – Path to text file containing ells for the noise power spectra.
pbl_save_dir (str) – Path to directory into which to save bandpower binning matrices, which are then loaded inside the likelihood module.
obs_bp_save_dir (str) – Path to directory into which to save binned ‘observed’ (fiducial) power spectra, which are then loaded inside the likelihood module.
inv_cov_save_dir (str) – Path to directory into which to save precomputed inverse bandpower covariance matrices, which are then loaded inside the likelihood module.
varied_params (list) – List of CosmoSIS parameter names whose values are varied across the grid.
like_save_dir (str) – Path to directory into which to save likelihood files, one for each number of bandpowers.
cov_fsky (float, optional) – If supplied, covariance will be multiplied by 1 / cov_fsky. (Default 1.0.)
- loop_likelihood_nbin.like_bp_gauss_mix_loop_nbin(grid_dir, n_bps, n_zbin, lmax_like, lmin_like, lmax_in, lmin_in, fid_pos_pos_dir, fid_she_she_dir, fid_pos_she_dir, pos_nl_path, she_nl_path, mixmats_path, bp_cov_filemask, binmixmat_save_dir, obs_bp_save_dir, varied_params, like_save_dir)
Run the like_bp_gauss_mix likelihood module over a CosmoSIS grid repeatedly for different numbers of bandpowers, saving a separate likelihood file for each number of bandpowers.
- Parameters
grid_dir (str) – Path to CosmoSIS grid.
n_bps (list) – List of numbers of bandpowers.
n_zbin (int) – Number of redshift bins.
lmax_like (int) – Maximum l to use in the likelihood.
lmin_like (int) – Minimum l to use in the likelihood.
lmax_in (int) – Maximum l included in mixing.
lmin_in (int) – Minimum l supplied in theory and noise power spectra.
fid_pos_pos_dir (str) – Path to fiducial position-position power spectra.
fid_she_she_dir (str) – Path to fiducial shear-shear power spectra.
fid_pos_she_dir (str) – Path to fiducial position-shear power spectra.
pos_nl_path (str) – Path to text file containing position noise power spectrum.
she_nl_path (str) – Path to text file containing shear noise power spectrum.
mixmats_path (str) – Path to mixing matrices in numpy .npz file with four arrays (mixmat_nn_to_nn, mixmat_ne_to_ne, mixmat_ee_to_ee, mixmat_bb_to_ee) each with shape (lmax_like - lmin_in + 1, lmax_in - lmin_in + 1).
bp_cov_filemask (str) – Path to precomputed bandpower covariance with {n_bp} placeholder, in numpy .npz file with array name cov, with shape (n_data, n_data) where n_data = n_spectra * n_bandpowers.
binmixmat_save_dir (str) – Path to directory into which to save combined mixing and binning matrices, which are then loaded inside the likelihood module.
obs_bp_save_dir (str) – Path to directory into which to save binned ‘observed’ (mixed fiducial) power spectra, which are then loaded inside the likelihood module.
varied_params (list) – List of CosmoSIS parameter names whose values are varied across the grid.
like_save_dir (str) – Path to directory into which to save likelihood files, one for each number of bandpowers.
- loop_likelihood_nbin.like_cf_gauss_loop_nbin(grid_dir, n_theta_bins, n_zbin, lmin, lmax, theta_min, theta_max, fid_pos_pos_dir, fid_she_she_dir, fid_pos_she_dir, obs_path, survey_area_sqdeg, gals_per_sqarcmin_per_zbin, sigma_e, varied_params, like_save_dir, cov_fsky=1.0)
Run the like_cf_gauss likelihood module over a CosmoSIS grid repeatedly for different numbers of theta bins, saving a separate likelihood file for each number of theta bins.
- Parameters
grid_dir (str) – Path to CosmoSIS grid.
n_theta_bins (list) – List of numbers of theta bins.
n_zbin (int) – Number of redshift bins.
lmin (int) – Minimum l to use as input.
lmax (int) – Maximum l to use as input.
theta_min (float) – Minimum theta in radians.
theta_max (float) – Maximum theta in radians.
fid_pos_pos_dir (str) – Path to fiducial position-position power spectra.
fid_she_she_dir (str) – Path to fiducial shear-shear power spectra.
fid_pos_she_dir (str) – Path to fiducial position-shear power spectra.
obs_path (str) – Path to mock observation generated by obs_from_fid.
survey_area_sqdeg (float) – Survey area in square degrees.
gals_per_sqarcmin_per_zbin (float) – Average number of galaxies per square arcminute per redshift bin.
sigma_e (float) – Intrinsic ellipticity dispersion per component.
varied_params (list) – List of CosmoSIS parameter names whose values are varied across the grid.
like_save_dir (str) – Path to directory into which to save likelihood files, one for each number of bandpowers.
cov_fsky (float, optional) – Sky fraction, default 1. Covariance is multiplied by 1/cov_fsky.
- loop_likelihood_nbin.obs_from_fid(input_dir, output_path, n_zbin, lmax, lmin)
Produce a noiseless mock observation for input to like_cf_gauss_loop_nbin from fiducial Cls, assuming zero B-modes.
- Parameters
input_dir (str) – Path to base directory containing fiducial Cls, assumed to contain subdirectories called ‘galaxy_cl’, ‘shear_cl’ and ‘galaxy_shear_cl’.
output_path (str) – Path to save the output as a .npz file.
n_zbin (int) – Number of redshift bins, assuming 1 position field and 1 shear field per redshift bin.
lmax (int) – Maximum l to load.
lmin (int) – Minimum l in the input.