9.9. Fragility Functions from MCA

plotter.plot_fragility_from_mca(cloud_dict, imt_label, xlims, ylims, title=None, cloud_method=None, plot_bootstrap=False, pFlag=True, export_path=None)[source]

Generates a fragility analysis plot showing the Probability of Exceedance (PoE) for multiple damage states using Modified Cloud Analysis (MCA) results.

Supports both uncertainty quantification approaches:

  • 'bootstrap': plots the mean fragility curves and, optionally, individual bootstrap realizations as a faint background cloud.

  • 'classical': plots the Robust Fragility mean and a shaded ±k·σ confidence band derived from the posterior variance (Jalayer et al. 2017).

The cloud_method is auto-detected from cloud_dict['fragility']['cloud_method'] when the argument is None (default), falling back to 'bootstrap' for dicts produced by older code that does not carry the key.

The figure uses self.figsize with fixed axes margins and is saved without bbox_inches='tight' so that every output image has identical, deterministic pixel dimensions.

Parameters:
  • cloud_dict (dict) –

    Standardized dictionary returned by postprocessor.process_mca_results(). Required keys:

    • 'fragility': contains intensities (1-D array), poes (2-D), medians, betas_total.

    • For 'bootstrap': 'bootstraps' sub-dict with alpha0, alpha1 arrays and optional poes_all (3-D array of per-iteration curves).

    • For 'classical': 'fragility' must also contain poes_robust_plus and poes_robust_minus; and 'mcmc' sub-dict with chi_mean.

  • imt_label (str) – X-axis label (e.g., 'PGA [g]', 'Sa(T1) [g]').

  • xlims (tuple of float) – (min, max) limits for the X-axis.

  • ylims (tuple of float) – (min, max) limits for the Y-axis.

  • title (str, optional) – Custom plot title. If None, no title is displayed.

  • cloud_method ({'bootstrap', 'classical'} or None, optional) – Selects the plotting style. When None (default), the value is read from cloud_dict['fragility'].get('cloud_method', 'bootstrap').

  • plot_bootstrap (bool, default False) – Bootstrap only. If True, plots all individual bootstrap fragility curves with low alpha as a background cloud. Ignored when cloud_method='classical'.

  • pFlag (bool, default True) – If True, renders and/or saves the figure. If False, closes the figure immediately (useful for batch runs).

  • export_path (str, optional) – Full file path (including extension) for saving the figure. The parent directory is created automatically if needed.

Return type:

None

Example

from openquake.vmtk.plotter import plotter

pl = plotter()
# cloud_dict from postprocessor.process_mca_results()
pl.plot_fragility_from_mca(
    cloud_dict=cloud_dict,
    imt_label="Sa(T1) [g]",
    xlims=(0.0, 3.0),
    ylims=(0.0, 1.0),
    title="Fragility Functions — MCA",
    export_path="fragility_mca.png",
)