error_vs_nbin module

Functions to plot statistical error as a function of number of angular bins.

error_vs_nbin.area_vs_nbin(cl_like_filemask, cf_like_filemask, contour_levels_sig, n_bps, n_theta_bins, save_path=None)

Plot average area of w0-wa contours against number of angular bins for the power spectrum and correlation function side-by-side.

Parameters
  • cl_like_filemask (str) – Path to power spectrum likelihood files as output by loop_likelihood_nbin.like_bp_gauss_loop_nbin (full sky) or like_bp_gauss_mix_loop_nbin (cut sky), with {n_bp} placeholder.

  • cf_like_filemask (str) – Path to correlation function likelihood files as output by loop_likelihood_nbin.like_cf_gauss_loop_nbin, with {n_bin} placeholder.

  • contour_levels_sig (list) – List or other sequence of sigma confidence levels over which to average the contour area; can be integers e.g. [1, 2, 3] or not e.g. np.arange(1, 3, 100).

  • n_bps (list) – list or other sequence of numbers of bandpowers over which to iterate.

  • n_theta_bins (list) – List or other sequence of numbers of theta bins over which to iterate.

  • save_path (str, optional) – Path to save the combined plot, if supplied. If not supplied, plot will be shown.

error_vs_nbin.area_vs_nbin_fsky_inka(inka_like_filemask, fsky_like_filemask, contour_levels_sig, n_bps, plot_save_path=None)

Plot w0-wa contour area against number of bandpowers for the cut-sky power spectrum using the improved NKA and fsky approximation side-by-side.

Parameters
  • inka_like_filemask (str) – Path to log-likelihood files generated with the improved NKA method using loop_likelihood_nbin.like_bp_gauss_mix_loop_nbin, with {n_bp} placeholder.

  • fsky_like_filemask (str) – Path to log-likelihood files generated with the fsky approximation using loop_likelihood_nbin.like_bp_gauss_loop_nbin, with {n_bp} placeholder.

  • contour_levels_sig (list) – List or other sequence of sigma confidence levels over which to average the contour area; can be integers e.g. [1, 2, 3] or not e.g. np.arange(1, 3, 100).

  • n_bps (list) – list or other sequence of numbers of bandpowers over which to iterate.

  • plot_save_path (str, optional) – Path to save plot. If not supplied, plot will be displayed.

error_vs_nbin.plot_width_vs_nbin_grid(data_path, param_labels, plot_save_path=None)

Plot grid of single-parameter error against number of angular bins for all parameters and lmax/theta_min values, using data prepared with prepare_width_vs_nbin_grid.

Parameters
  • data_path (str) – Path to data output by prepare_width_vs_nbin_grid.

  • param_labels (dict) – Dictionary of latex-formatted parameter names corresponding to each parameter ID used in the {params} argument to prepare_width_vs_nbin_grid, excluding the dollar signs used to indicate maths mode. For example, if omega_m is referred to in likelihood filenames as omm, then its entry might be { ... 'omm': 'omega_\mathrm{m}' ...}.

  • plot_save_path (str, optional) – Path to save plot. If not supplied, plot is displayed.

error_vs_nbin.prepare_width_vs_nbin_grid(cl_like_filemask, cf_like_filemask, contour_levels_sig, n_bps, n_theta_bins, params, lmaxes, theta_min_degs, data_save_path)

Prepare the width-vs-nbin grid plot, then save the data to file for fast plotting using plot_width_vs_nbin_grid.

Parameters
  • cl_like_filemask (str) – Path to power spectrum likelihood files as output by loop_likelihood_nbin.like_bp_gauss_loop_nbin, with placeholders for {param}, {lmax} and {n_bp}.

  • cf_like_filemask (str) – Path to correlation function likelihood files as output by loop_likelihood_nbin.like_cf_gauss_loop_nbin, with placeholders for {param}, {theta_min_deg} and {n_bin}.

  • contour_levels_sig (list) – List or other sequence of sigma confidence levels over which to average the contour area; can be integers e.g. [1, 2, 3] or not e.g. np.arange(1, 3, 100).

  • n_bps (list) – list or other sequence of numbers of bandpowers over which to iterate.

  • n_theta_bins (list) – List or other sequence of numbers of theta bins over which to iterate.

  • params (list) – List of cosmological parameter labels to iterate over as the {param} argument in cl_like_filemask and cf_like_filemask.

  • lmaxes (list) – List of lmax values to iterate over as the {lmax} argument in cl_like_filemask.

  • theta_min_degs (list) – List of theta_min values in degrees to iterate over as the {theta_min_deg} argument in {cf_like_filemask}.

  • data_save_path (str) – Path to save intermediate data to pass to plot_width_vs_nbin_grid.

error_vs_nbin.width_vs_nbin_noise(cl_like_filemask, cf_like_filemask, contour_levels_sig, n_bps, n_theta_bins, plot_save_path=None)

Plot single-parameter error against number of angular bins for three different noise levels on each panel, with three panels: power spectrum with x100/x0.01 noise on top, power spectrum with x2/x0.5 noise on lower left, and correlation function with x2/x0.5 noise on lower right.

Parameters
  • cl_like_filemask (str) – Path to power spectrum log-likelihood files as output by loop_likelihood_nbin.like_bp_gauss_loop_nbin, with placeholders for {noise_level} and {n_bp}. Values for {noise_level} are fixed to [0.01, 0.5, 1, 2, 100].

  • cf_like_filemask (str) – Path to correlation function log-likelihood files as output by loop_likelihood_nbin.like_cf_gauss_loop_nbin, with placeholders for {noise_level} and {n_bin}. Values for {noise_level} are fixed to [0.5, 1, 2].

  • contour_levels_sig (list) – List or other sequence of sigma confidence levels over which to average the contour area; can be integers e.g. [1, 2, 3] or not e.g. np.arange(1, 3, 100).

  • n_bps (list) – list or other sequence of numbers of bandpowers over which to iterate.

  • n_theta_bins (list) – List or other sequence of numbers of theta bins over which to iterate.

  • plot_save_path (str, optional) – Path to save figure, if supplied. If not supplied, figure will be displayed.

error_vs_nbin.width_vs_nbin_sqrt_lmax(log_like_filemask, contour_levels_sig, n_bps, params, param_labels, lmaxes, plot_save_path=None)

Plot single-parameter error against number of bandpowers adjusted as sqrt(lmax) for the full-sky power spectrum.

Parameters
  • log_like_filemask (str) – Path to log-likelihood files as output by loop_likelihood_nbin.like_bp_gauss_loop_nbin, with placeholders for {param}, {lmax} and {n_bp}.

  • contour_levels_sig (list) – List or other sequence of sigma confidence levels over which to average the contour area; can be integers e.g. [1, 2, 3] or not e.g. np.arange(1, 3, 100).

  • n_bps (list) – list or other sequence of numbers of bandpowers over which to iterate.

  • params (list) – 2D nested list of cosmological parameter IDs, which will be used for the {param} argument to log_like_filemask. The first dimension represents rows on the grid and the second is columns within each row.

  • param_labels (dict) – Dictionary of the latex-formatted parameter label (excluding dollar signs denoting maths mode) corresponding to each parameter ID appearing in params.

  • lmaxes (list) – List or other sequence of lmax values over which to iterate.

  • plot_save_path (str, optional) – Path to save figure. If not supplied, figure will be displayed.