GWForge.fisher.plot

Corner plots for Fisher and DALI results.

A Fisher forecast is a covariance matrix, not a set of samples, so the way to draw it is to realise the multivariate normal it describes and hand that to the same corner machinery everything else uses. That also makes a Fisher result and a sampled DALI posterior directly overlayable, which is the point.

Attributes

Functions

samples_from_covariance(mean, covariance[, size, seed])

Draw from the multivariate normal a Fisher matrix describes.

overlay_corner(datasets, parameters[, truths, save, title])

Overlay several sample sets on one corner plot.

Module Contents

GWForge.fisher.plot.CONTOUR_LEVELS[source]
GWForge.fisher.plot.OVERLAY_COLOURS = ('#ca0020', '#0571b0', '#4daf4a', '#984ea3')[source]
GWForge.fisher.plot.samples_from_covariance(mean, covariance, size=200000, seed=None)[source]

Draw from the multivariate normal a Fisher matrix describes.

Parameters:
  • mean (array_like) – Fiducial parameter values.

  • covariance (array_like) – (n, n) covariance matrix.

  • size (int) – Number of samples.

  • seed (int or None) – Seed for reproducibility.

Returns:

(size, n) samples.

Return type:

numpy.ndarray

Notes

A Fisher covariance can pick up tiny negative eigenvalues from rounding when the matrix is poorly conditioned, which makes the normal undrawable. Those are clipped to zero with a warning; a genuinely indefinite covariance means the forecast itself is not trustworthy.

GWForge.fisher.plot.overlay_corner(datasets, parameters, truths=None, save=None, title=None)[source]

Overlay several sample sets on one corner plot.

Parameters:
  • datasets (sequence of tuple) – (label, samples) pairs, each samples of shape (n_samples, n_parameters) with columns ordered as parameters.

  • parameters (sequence of str) – Parameter names, used for the axis labels.

  • truths (array_like or None) – Reference values to mark.

  • save (str or None) – Path to write the figure to. When None the figure is returned unsaved.

  • title (str or None) – Figure title.

Return type:

matplotlib.figure.Figure

Raises:

ValueError – If datasets is empty or a sample array has the wrong width.