cosmolike_utils module

Contains utility functions for CosmoLike/CosmoCov.

cosmolike_utils.create_nz(save_path, z_min=0, z_max=5.3423, z_steps=10000, z_mean=None, z_std=0.3)

Create a N(z) file suitable for input to CosmoLike, using a Gaussian redshift distribution. Parameters default to match the Takahashi et al. HSC simulations with 5 bins.

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

  • z_min (float, optional) – Minimum z value (default 0).

  • z_max (float, optional) – Maximum z value (default 5.3423).

  • z_steps (int, optional) – Number of steps to use between z_min and z_max (default 10000).

  • z_mean (list, optional) – Mean z value of each bin (default [0.65, 0.95, 1.25, 1.55, 1.85]).

  • z_std (float, optional) – Standard deviation in z of every bin (default 0.3).

cosmolike_utils.delete_txt(input_filemask)

Delete all .txt files matching the input filemask if the corresponding .npz file is present.

Parameters

input_filmask (str) – glob filemask matching input files.

cosmolike_utils.get_mask_cl(mask_path, save_path, lmax, nside)

Calculate mask power spectrum and save in format suitable for input to CosmoLike.

Parameters
  • mask_path (str) – Path to mask fits file.

  • save_path (str) – Path to save mask power spectrum to.

  • lmax (int) – Maximum l.

  • nside (int) – Healpix resolution to use (mask will be up/downgraded to this).

cosmolike_utils.txt_to_npz(input_filemask, fsky=None)

Convert all .txt files matching the input filemask to .npz files (as a copy, without deleting the original). Optionally apply a 1/fsky factor.

Parameters
  • input_filemask (str) – glob filemask matching input files.

  • fsky (float, optional) – Sky fraction - if supplied, matrix will be multiplied by 1/fsky. This should generally only be used for the connected non-Gaussian covariance, and care must be taken to not account for it twice (here and elsewhere).