cov_distance module

Functions relating to the covariance-weighted distance statistic.

cov_distance.get_dist_sq_fullskycl(cl, inv_cov)

For a set of power spectra cl, get the square of the covariance-weighted distance, cl @ inv_cov @ cl, using the fact that different l are independent to avoid the full calculation.

Parameters
  • cl (2D numpy array) – Power spectra with shape (n_spectra, n_ell).

  • inv_cov (2D numpy array) – Inverse of the covariance matrix corresponding to the flattened cl array, flattened in row-major (spectra-major) order.

Returns

Squared covariance-weighted distance.

Return type

float

cov_distance.get_weighted_pbl(n_bandpowers, output_lmin, output_lmax, input_lmin=None, input_lmax=None, weighting='default')

Get the bandpower binning matrix with different l weighting schemes.

Options are:
  • default = l(l+1)/2π

  • flat = 1

  • sin = sin(π/l)

Parameters
  • n_bandpowers (int) – Number of bandpowers.

  • output_lmin (int) – Minimum l included in the first bandpower.

  • output_lmax (int) – Maxmimum l included in the last bandpower.

  • input_lmin (int, optional) – Minimum l included in the input (default is equal to output_lmin).

  • input_lmax (int, optional) – Maximum l included in the input (default is equal to output_lmax).

  • weighting (str, optional) – Weighting scheme. Options are default, flat and sin, as described above.

cov_distance.plot_dist_vs_nbin(plot_data_path, plot_save_path=None)

Plot covariance-weighted distance against number of angular bins for the power spectrum with three different weightings and the correlation function, using data prepared with prepare_dist_vs_nbin.

Parameters
  • plot_data_path (str) – Path to output of prepare_dist_vs_nbin.

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

cov_distance.plot_validation(plot_data_path, plot_save_path=None)

Produce the covariance-weighted distance validation plot, using data produced with prepare_validation.

Parameters
  • plot_data_path (str) – Path to output of prepare_validation.

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

cov_distance.prepare_dist_vs_nbin(n_zbin, lmax, lmin, diag_cls_no_b_path, diag_cls_with_b_path, n_bps, pos_nl_path, she_nl_path, theta_min, theta_max, n_theta_bins, survey_area_sqdeg, gals_per_sqarcmin_per_zbin, sigma_e, data_save_path)

Calculate covariance-weighted distance vs number of angular bins for the power spectrum with three different weightings and the correlation function, using 3x2pt power spectra with and without B-modes produced with param_grids.load_diagonal_3x2pt_cl and load_diagonal_3x2pt_cl_with_b, and save the result to disk for fast plotting with plot_dist_vs_nbin.

Parameters
  • n_zbin (int) – Number of redshift bins. 1 position field and 1 shear field per redshift bin are assumed.

  • lmax (int) – Maximum l.

  • lmin (int) – Minimum l.

  • diag_cls_no_b_path (str) – Path to output of load_diagonal_3x2pt_cl.

  • diag_cls_with_b_path (str) – Path to output of load_diagonal_3x2pt_cl_with_b.

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

  • pos_nl_path (str) – Path to position power spectrum as a text file.

  • she_nl_path (str) – Path to shear power spectrum as a text file.

  • theta_min (float) – Minimum theta in radians.

  • theta_max (float) – Maximum theta in radians.

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

  • 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 galaxy ellipticity dispersion per component.

  • data_save_path (str) – Path to save output for fast plotting with plot_dist_vs_nbin.

cov_distance.prepare_validation(n_zbin, lmax, lmin, diag_cls_no_b_path, diag_cls_with_b_path, pos_nl_path, she_nl_path, theta_min, theta_max, n_theta_bin, survey_area_sqdeg, gals_per_sqarcmin_per_zbin, sigma_e, data_save_path)

Calculate the data for the covariance-weighted distance validation plots, using 3x2pt power spectra with and without B-modes produced with param_grids.load_diagonal_3x2pt_cl and load_diagonal_3x2pt_cl_with_b, and save to file for fast plotting with plot_validation.

Parameters
  • n_zbin (int) – Number of redshift bins. 1 position field and 1 shear field per redshift bin are assumed.

  • lmax (int) – Maximum l.

  • lmin (int) – Minimum l.

  • diag_cls_no_b_path (str) – Path to output of load_diagonal_3x2pt_cl.

  • diag_cls_with_b_path (str) – Path to output of load_diagonal_3x2pt_cl_with_b.

  • pos_nl_path (str) – Path to position power spectrum as a text file.

  • she_nl_path (str) – Path to shear power spectrum as a text file.

  • theta_min (float) – Minimum theta in radians.

  • theta_max (float) – Maximum theta in radians.

  • n_theta_bin (int) – Number of theta bins.

  • 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 galaxy ellipticity dispersion per component.

  • data_save_path (str) – Path to save output for fast plotting with plot_validation.