state_shewhart_chart_visualizer

Shewhart state visualizer implementation.

This module provides a visualizer for rendering Shewhart control chart algorithm state evolution over time, including running mean, control limits, and sliding window mean.

class pysatl_cpd.algorithms.online.control_charts.visualizers.state_shewhart_chart_visualizer.ShewhartStatePlotOpts[source]

Bases: TypedDict

Plot options for Shewhart state subplot.

xlabel: str
ylabel: str
grid: bool
title: str | None
class pysatl_cpd.algorithms.online.control_charts.visualizers.state_shewhart_chart_visualizer.ShewhartStateDrawOpts[source]

Bases: TypedDict

Drawing options for Shewhart state lines.

mean_color: str
mean_linewidth: float
mean_label: str
control_limit_color: str
control_limit_linestyle: str
control_limit_linewidth: float
control_limit_label: str
window_mean_color: str
window_mean_linewidth: float
window_mean_label: str
fill_alpha: float
class pysatl_cpd.algorithms.online.control_charts.visualizers.state_shewhart_chart_visualizer.ShewhartStateBandOpts[source]

Bases: TypedDict

Band calculation options for Shewhart control limits.

band_size: float
class pysatl_cpd.algorithms.online.control_charts.visualizers.state_shewhart_chart_visualizer.ShewhartStateVisualizer(backend)[source]

Bases: IOnlineStateVisualizer[ShewhartControlChartState]

Visualizer for Shewhart control chart algorithm state evolution.

This visualizer renders: - Running mean (mu) - Control limits (mu +/- k * sigma / sqrt(w)) where w is window size - Sliding window mean (x_bar_w)

Parameters:

backend (DrawBackend) – Plotting backend to use for rendering.

__init__(backend)[source]
Parameters:

backend (DrawBackend)

Return type:

None

property axes: set[str]

Declare the subplot names required by this visualizer.

Returns:

Set containing “shewhart_state” subplot name.

Return type:

set[str]

set_states(states, **draw_options)[source]

Set the sequence of algorithm states to visualize.

Parameters:
  • states (Sequence[ShewhartControlChartState | None]) – Sequence of Shewhart state snapshots for each observation step. None values indicate steps where state was not captured.

  • **draw_options (Any) – Additional backend-specific drawing options.

Returns:

Returns self to allow method chaining.

Return type:

Self

set_plot_opts(**options)[source]

Set general plot options for Shewhart state subplot.

Parameters:

**options (Unpack[ShewhartStatePlotOpts]) –

xlabel

X-axis label.

ylabel

Y-axis label.

grid

Whether to show grid lines.

Returns:

Returns self to allow method chaining.

Return type:

Self

set_draw_opts(**options)[source]

Set drawing options for Shewhart state lines.

Parameters:

**options (Unpack[ShewhartStateDrawOpts]) –

mean_color

Color of the running mean line.

mean_linewidth

Width of the running mean line.

mean_label

Legend label for running mean.

control_limit_color

Color of the control limit lines.

control_limit_linestyle

Line style for control limits.

control_limit_linewidth

Width of the control limit lines.

control_limit_label

Legend label for control limits.

window_mean_color

Color of the window mean line.

window_mean_linewidth

Width of the window mean line.

window_mean_label

Legend label for window mean.

fill_alpha

Opacity of the fill between control limits.

Returns:

Returns self to allow method chaining.

Return type:

Self

set_band_opts(**options)[source]

Set band calculation options for control limits.

Parameters:

**options (Unpack[ShewhartStateBandOpts]) –

band_size

Multiplier k for control limits (mu +/- k * sigma / sqrt(w)). Default is 3.0.

Returns:

Returns self to allow method chaining.

Return type:

Self