ts_shape.events.engineering.process_window
| Name | Description |
|---|---|
ProcessWindowEvents | Engineering: Process Window Analysis |
ProcessWindowEvents
ProcessWindowEvents(
dataframe: pd.DataFrame,
signal_uuid: str,
*,
event_uuid: str = "eng:process_window",
value_column: str = "value_double",
time_column: str = "systime"
) -> None
Bases: Base
Engineering: Process Window Analysis
Analyze time-windowed process statistics for shift reports, SPC context, and trend monitoring. Answers 'how is my process doing this hour/shift/day?'
Methods:
- windowed_statistics: Per-window count, mean, std, min, max, percentiles.
- detect_mean_shift: Flag windows where mean shifts significantly.
- detect_variance_change: Flag windows where variance changes significantly.
- window_comparison: Compare each window to overall baseline.
| Name | Description |
|---|---|
windowed_statistics | Per-window descriptive statistics. |
detect_mean_shift | Flag windows where mean shifts significantly from the previous window. |
detect_variance_change | Flag windows where variance changes significantly. |
window_comparison | Compare each window mean to the overall baseline. |
| Name | Type | Description | Default |
|---|---|---|---|
dataframe | DataFrame | Long-format timeseries frame (one row per sample, uuid identifies the signal). | required |
signal_uuid | str | UUID of the signal to analyze. | required |
event_uuid | str | UUID stamped on emitted events. | 'eng:process_window' |
value_column | str | Column holding the signal values. | 'value_double' |
time_column | str | Timestamp column. | 'systime' |
windowed_statistics
windowed_statistics(window: str = '1h') -> pd.DataFrame
Per-window descriptive statistics.
| Name | Type | Description | Default |
|---|---|---|---|
window | str | Resample window (pandas offset string, e.g. '1h', '8h'). | '1h' |
| Type | Description |
|---|---|
DataFrame | DataFrame with columns: start, end, duration_seconds, uuid, |
DataFrame | source_uuid, count, sample_count, mean, std, min, max, median, |
DataFrame | p25, p75, range. end is start + window. std is the |
DataFrame | sample standard deviation (ddof=1), so it is NaN for a window |
DataFrame | with a single value. |
DataFrame | Canonical twin columns: sample_count (after count); it holds the same |
DataFrame | values as the deprecated column right before it, which is removed |
DataFrame | in the next major release. |
detect_mean_shift
detect_mean_shift(window: str = '1h', sensitivity: float = 2.0) -> pd.DataFrame
Flag windows where mean shifts significantly from the previous window.
A shift is detected when |current_mean - prev_mean| > sensitivity * prev_std. A previous window without a std (a single value: NaN) is skipped.
| Name | Type | Description | Default |
|---|---|---|---|
window | str | Resample window passed to :meth:windowed_statistics. | '1h' |
sensitivity | float | Shift between consecutive window means, in multiples of the previous window's std, above which (strictly) a window is flagged. | 2.0 |
| Type | Description |
|---|---|
DataFrame | DataFrame with columns: start, end, duration_seconds, uuid, |
DataFrame | source_uuid, is_delta, prev_mean, current_mean, shift_sigma. |
DataFrame | start is the previous window's start, end the current |
DataFrame | window's start. |
detect_variance_change
detect_variance_change(
window: str = "1h", ratio_threshold: float = 2.0
) -> pd.DataFrame
Flag windows where variance changes significantly.
A change is detected when (current_std / prev_std) > ratio_threshold
or < (1 / ratio_threshold). Window pairs where either std is NaN (a
single-value window) are skipped. A change from a constant window
(prev_std == 0) to a varying one is flagged with variance_factor
NaN: the ratio is undefined, never inf.
| Name | Type | Description | Default |
|---|---|---|---|
window | str | Resample window passed to :meth:windowed_statistics. | '1h' |
ratio_threshold | float | Std ratio (current / previous) strictly above which, or strictly below whose reciprocal, a window is flagged. Should be > 1. | 2.0 |
| Type | Description |
|---|---|
DataFrame | DataFrame with columns: start, end, duration_seconds, uuid, |
DataFrame | source_uuid, is_delta, prev_std, current_std, variance_ratio, |
DataFrame | variance_factor (current_std / prev_std). start is the |
DataFrame | previous window's start, end the current window's start. |
DataFrame | Canonical twin columns: variance_factor (after |
DataFrame | variance_ratio, which is not a 0-1 fraction); it holds the |
DataFrame | same values as the deprecated column right before it, which is |
DataFrame | removed in the next major release. |
window_comparison
window_comparison(window: str = '1h') -> pd.DataFrame
Compare each window mean to the overall baseline.
| Name | Type | Description | Default |
|---|---|---|---|
window | str | Resample window passed to :meth:windowed_statistics. A window is anomalous when its mean is more than 2 std of the window means away from their average. | '1h' |
| Type | Description |
|---|---|
DataFrame | DataFrame with columns: start, end, duration_seconds, uuid, |
DataFrame | source_uuid, mean, z_score_vs_global, is_anomalous. |