plotting module

Functions for producing plots.

plotting.cng_approx(bin_weight_ratios_path, mix_weight_ratios_path, save_path=None)

Plot histograms of test ratios for the connected non-Gaussian approximation as obtained using cng_approx.test_bin_weights and cng_approx.test_mix_weights.

Parameters
  • bin_weight_ratios_path – Path to binning weight test ratios output by cng_approx.test_bin_weights.

  • mix_weight_ratios_path – Path to mixing weight test ratios output by cng_approx.test_mix_weights.

  • save_path (str, optional) – Path to save figure to, if supplied. If not supplied, figure is displayed.

plotting.cov_diags(data_path, lmax, lmin, lmax_plot, roll_window_size, save_path=None)

Plot diagonals of the covariance matrix for each theory contribution and simulations, for each mask.

Parameters
  • data_path (str) – Path to prepared data as output by plot_utils.get_cov_diags.

  • lmax (int) – Maximum l in the data.

  • lmin (int) – Minimum l in the data.

  • lmax_plot (int) – Maximum l to include in the plot.

  • roll_window_size (int) – Number of ells to include in the rolling average.

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

plotting.cov_gaussian(data_path, lmax, lmin, roll_window_size, save_path=None)

Plot diagonals of the Gaussian covariance matrix compared to simulations, for each mask.

Parameters
  • data_path (str) – Path to prepared data as output by plot_utils.get_cov_diags_gaussian.

  • lmax (int) – Maximum l.

  • lmin (int) – Minimum l.

  • roll_window_size (int) – Number of ells to include in the rolling average.

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

plotting.cov_mats(data_path, lmax_plot, lmin, row_order, row_labels, downsample_fac=30, save_path=None)

Plot correlation matrices for each theory contribution and covariance, for each mask.

Parameters
  • data_path (str) – Path to prepared data as output by plot_utils.get_cov_mats.

  • lmax_plot (int) – Maximum l to include in the plot.

  • lmin (int) – Minimum l in the data.

  • row_order (list) – Order for rows as they are labelled in the input data, e.g. [‘corr_g’, ‘corr_ss’, ‘corr_cng’, ‘corr_tot’, ‘sim_corr’].

  • row_labels (list) – Label for each row.

  • downsample_fac (int, optional) – Factor by which to downsample the matrices for plotting, default 30.

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

plotting.cov_withnoise(data_path, lmax_plot, save_path=None)

Plot diagonals of the covariance matrix with noise included for each theory contribution (no simulations), for each mask.

Parameters
  • data_path (str) – Path to prepared data as output by plot_utils.get_cov_diags_withnoise.

  • lmax_plot (int) – Maximum l to include in the plot.

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

plotting.plot_masks(full_euclid_mask_path, dr1_mask_path, full_euclid_coord='E', dr1_coord='G', save_path=None)

Plot the full Euclid-like mask and Euclid DR1-like masks together, in galactic coordinates.

Parameters
  • full_euclid_mask_path (str) – Path to full Euclid-like mask.

  • dr1_mask_path (str) – Path to Euclid DR1-like mask.

  • full_euclid_coord (str, optional) – Input coordinates for full Euclid-like mask: ‘E’ for ecliptic, ‘G’ for galactic. Default ‘E’.

  • dr1_coord (str, optional) – Input coordinates for Euclid DR1-like mask: ‘E’ for ecliptic, ‘G’ for galactic. Default ‘G’.

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

plotting.post_2d(panels, labels, colours, linestyles, contour_levels_sig, column_titles, param_labels, print_areas=False, save_path=None)

Plot a grid of 2D posteriors, each panel itself containing multiple posterior distributions.

Parameters
  • panels (list) – Configuration of the panels, as a list of lists of dicts. The top-level list defines the rows; the middle-level list defines the panels within each row; the dict contains the config for each panel. The dict has the following keys: like_paths (list) - list of paths to each log-likelihood txt file; xlims (float, float) - x-axis limits; ylims (float, float) - y-axis limits; smoooth_sigma (list) - kernel standard deviation for Gaussian smoothing for each posterior.

  • labels (list) – List of legend labels for each posterior (same for every panel).

  • colours (list) – List of colours for each posterior (same for every panel).

  • linestyles (list) – List of linestyles for each posterior (same for every panel).

  • contour_levels_sig (list) – List of confidence regions to plot in ascending order, e.g. [1, 3].

  • column_titles (list) – List of column titles.

  • param_labels (list) – Axis labels for the x, y, z parameters.

  • print_areas (bool, optional) – If True, print relative areas of the different posteriors. Note that smoothing can affect these results, so for reliable results smoothing should be switched off to extract relative areas, and then smoothing values should be set to preserve unsmoothed relative areas. Default False.

  • save_path (str, optional) – Path to save figure to, if supplied. If not supplied, figure is displayed.

plotting.post_3d(post_paths, labels, colours, linestyles, contour_levels_sig, x_label=None, y_label=None, z_label=None, x_lims=None, y_lims=None, z_lims=None, smooth_xy=None, smooth_xz=None, smooth_yz=None, smooth_x=None, smooth_y=None, smooth_z=None, print_areas=False, save_path=None)

Produce triangle plot showing multiple 3D posteriors, each as output by plot_utils.get_3d_post.

Parameters
  • post_paths (list) – List of paths to 3D posterior .npz files, each as output by plot_utils.get_3d_post.

  • labels (list) – List of legend labels, one for each posterior grid.

  • colours (list) – List of colours, one for each posterior grid.

  • linestyles (list) – List of linestyles, one for each posterior grid.

  • contour_levels_sig (list) – List of confidence regions to plot in ascending order, e.g. [1, 3].

  • x_label (str, optional) – X-axis label - default None, i.e. no label.

  • y_label (str, optional) – Y-axis label - default None, i.e. no label.

  • z_label (str, optional) – Z-axis label - default None, i.e. no label.

  • x_lims ((float, float), optional) – X-axis limits - default None, limits set automatically.

  • y_lims ((float, float), optional) – Y-axis limits - default None, limits set automatically.

  • z_lims ((float, float), optional) – Z-axis limits - default None, limits set automatically.

  • smooth_xy (list, optional) – List of kernel standard deviations for Gaussian smoothing in the x-y plane, one for each posterior grid, or None for no smoothing (default None).

  • smooth_xz (list, optional) – List of kernel standard deviations for Gaussian smoothing in the x-z plane, one for each posterior grid, or None for no smoothing (default None).

  • smooth_yz (list, optional) – List of kernel standard deviations for Gaussian smoothing in the y-z plane, one for each posterior grid, or None for no smoothing (default None).

  • smooth_x (list, optional) – List of kernel standard deviations for Gaussian smoothing of the 1D x posterior, one for each posterior grid, or None for no smoothing (default None).

  • smooth_y (list, optional) – List of kernel standard deviations for Gaussian smoothing of the 1D y posterior, one for each posterior grid, or None for no smoothing (default None).

  • smooth_z (list, optional) – List of kernel standard deviations for Gaussian smoothing of the 1D z posterior, one for each posterior grid, or None for no smoothing (default None).

  • print_areas (bool, optional) – If True, print relative areas/widths of the different posteriors. Note that smoothing can affect these results, so for reliable results smoothing should be switched off to extract relative areas, and then smoothing values should be set to preserve unsmoothed relative areas. Default False.

  • save_path (str, optional) – Path to save figure to, if supplied. If not supplied, figure is displayed.