jwspecmcmc.plotting

Diagnostic plots for MCMC results.

Corner plots, trace plots, and flux posterior histograms.

Functions

plot_corner(result, *[, params, truths, ...])

Corner plot of posterior samples.

plot_flux_posterior(result, line_name, *[, ...])

Histogram of the flux posterior for a single line.

plot_traces(result, *[, params, figsize])

Trace plots of MCMC chains.

jwspecmcmc.plotting.plot_corner(result, *, params=None, truths=None, quantiles=None, **corner_kwargs)[source]

Corner plot of posterior samples.

Parameters:
  • result (MCMCResult) – MCMC result.

  • params (list of str, optional) – Parameter names to include (e.g. ["A_OIII_5007", "sigma_Ha"]). If None, plots all free parameters.

  • truths (np.ndarray, optional) – True values to mark on the plot.

  • quantiles (list of float, optional) – Quantiles for corner (default [0.16, 0.5, 0.84]).

  • **corner_kwargs – Additional keyword arguments passed to corner.corner().

Return type:

matplotlib.figure.Figure

jwspecmcmc.plotting.plot_flux_posterior(result, line_name, *, bins=50, ax=None)[source]

Histogram of the flux posterior for a single line.

Parameters:
  • result (MCMCResult) – MCMC result.

  • line_name (str) – Line name (e.g. "OIII_5007").

  • bins (int) – Number of histogram bins.

  • ax (matplotlib.axes.Axes, optional) – Axes to plot on. If None, creates a new figure.

Return type:

matplotlib.axes.Axes

jwspecmcmc.plotting.plot_traces(result, *, params=None, figsize=None)[source]

Trace plots of MCMC chains.

Parameters:
  • result (MCMCResult) – MCMC result. Must have chains (i.e. from emcee).

  • params (list of str, optional) – Parameter names to plot. If None, plots all free parameters.

  • figsize (tuple, optional) – Figure size.

Return type:

matplotlib.figure.Figure

Raises:

ValueError – If per-chain samples are not available (e.g. nautilus result).