9.11. Storey Loss Functions
- plotter.plot_slf_model(out, cache, edp_label, loss_label, xlims, ylims, title=None, pFlag=True, export_path=None)[source]
Generate a plot to visualize the Storey Loss Function (SLF) model output.
This function visualizes the storey loss for different realizations of a model by plotting the following: 1. Scatter plot of total storey loss for each realization. 2. Shaded region representing the 16th to 84th percentiles of the empirical data. 3. Plot of the median of the empirical data for simulations. 4. Fitted Storey Loss Function (SLF) curve.
The plot includes: - A scatter plot of the total loss per storey for each realization. - A shaded area representing the empirical 16th to 84th percentiles. - The median storey loss curve based on simulations. - The fitted SLF curve.
The figure uses
self.figsizewithconstrained_layoutand is saved withoutbbox_inches='tight'so that every output image has identical, deterministic pixel dimensions.- Parameters:
out (dict) – Results dictionary with keys
'edp_range'and'slf'(the fitted Storey Loss Function curve).cache (dict) – Cached simulation data with keys
'total_loss_storey','empirical_16th','empirical_84th', and'empirical_median'.edp_label (str) – Label for the x-axis (Engineering Demand Parameter).
loss_label (str) – Label for the y-axis (Storey Loss Ratio).
xlims (tuple of float) – (min, max) limits for the X-axis (EDP axis).
ylims (tuple of float) – (min, max) limits for the Y-axis (Loss axis).
title (str, optional) – Custom plot title.
pFlag (bool, optional) – If
Truethe plot is displayed or saved. Default isTrue.export_path (str, optional) – Full path including filename to save the plot. Directories are created if missing.
- Return type:
None
Example
from openquake.vmtk.plotter import plotter
pl = plotter()
# slf, cache from slfgenerator.generate()
pl.plot_slf_model(
slf=slf,
cache=cache,
edp_label="Interstorey Drift Ratio [-]",
loss_label="Storey Loss Ratio [-]",
export_path="slf_model.png",
)