plots.plot_resource_utilisation_comparison

plots.plot_resource_utilisation_comparison(
    event_log_a,
    event_log_b,
    *,
    metric='utilisation',
    ci_level=0.95,
    label_a='A',
    label_b='B',
    scenario_a=None,
    scenario_b=None,
    highlight_bands=None,
    **kwargs,
)

Bar chart comparing a resource utilisation metric between two scenarios.

The resource-utilisation counterpart to plot_scenario_comparison: turns vidigi.analysis.compare_replication_values into the same two-bar chart with CI error bars, built here from vidigi.analysis.resource_utilisation instead of event_durations. Always pools every step/resource together into one blended per-run figure (by="run", see vidigi.analysis.resource_utilisation); to compare one specific step or resource instead, call resource_utilisation(by=...) on each log directly and pass the metric column into compare_replication_values.

Parameters

Name Type Description Default
event_log_a pandas.DataFrame Long-format event logs, one per scenario, e.g. from TrialLogger.to_dataframe(). required
event_log_b pandas.DataFrame Long-format event logs, one per scenario, e.g. from TrialLogger.to_dataframe(). required
metric (utilisation, busy_time, mean_in_use) Which vidigi.analysis.resource_utilisation column to compare. "utilisation"
ci_level float Confidence level for each scenario’s interval and for the significance test. 0.95
label_a str Names for each scenario, used as bar labels. "A", "B"
label_b str Names for each scenario, used as bar labels. "A", "B"
scenario_a object or dict Capacity-resolution scenario for each log - see vidigi.analysis._resolve_resource_capacities. Distinct from label_a/label_b, since the two scenarios being compared usually differ in exactly this (e.g. a different resource count). None
scenario_b object or dict Capacity-resolution scenario for each log - see vidigi.analysis._resolve_resource_capacities. Distinct from label_a/label_b, since the two scenarios being compared usually differ in exactly this (e.g. a different resource count). None
highlight_bands list of dict Shaded threshold zones drawn behind the chart - see plot_duration_distribution’s parameter of the same name for the dict shape. None
**kwargs dict Additional keyword arguments forwarded to vidigi.analysis.resource_utilisation for both logs (e.g. resource_map=, event_position_df=, resource_capacities=, capacity=, warm_up=, limit_duration=, unclosed=). {}

Returns

Name Type Description
plotly.graph_objects.Figure

Raises

Name Type Description
ValueError If metric is not a resource-utilisation column, or a highlight_bands entry has neither lower nor upper set, or lower >= upper.
ImportError If scipy is not installed - see vidigi.analysis.mean_confidence_interval.

See Also

vidigi.analysis.compare_replication_values : The underlying implementation. plot_scenario_comparison : The event-duration analogue.

Examples

>>> plot_resource_utilisation_comparison(
...     baseline.to_dataframe(), extra_staff.to_dataframe(),
...     scenario_a=baseline_params, scenario_b=extra_staff_params,
...     resource_map={"treatment_begins": "n_cubicles"},
...     label_a="baseline", label_b="extra staff",
... )
<plotly.graph_objs._figure.Figure>
Back to top