processbehavior 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- processbehavior/__init__.py +133 -0
- processbehavior/analysis.py +2944 -0
- processbehavior/analysis_dataset.py +361 -0
- processbehavior/analysis_result.py +1276 -0
- processbehavior/calibration.py +70 -0
- processbehavior/capability.py +720 -0
- processbehavior/data_preparation.py +792 -0
- processbehavior/datasets/__init__.py +37 -0
- processbehavior/datasets/data/coffee_shop_demo_long.csv +385 -0
- processbehavior/datasets/loaders.py +66 -0
- processbehavior/datasets/synthetic.py +1711 -0
- processbehavior/derivations.py +602 -0
- processbehavior/effects_calculator.py +603 -0
- processbehavior/exceptions.py +216 -0
- processbehavior/exporters/__init__.py +5 -0
- processbehavior/exporters/excel_exporter.py +708 -0
- processbehavior/focused_result.py +329 -0
- processbehavior/formulation_spec.py +144 -0
- processbehavior/loss_function.py +517 -0
- processbehavior/maximum_information.py +285 -0
- processbehavior/plotting/__init__.py +46 -0
- processbehavior/plotting/_math.py +121 -0
- processbehavior/plotting/capability_chart.py +858 -0
- processbehavior/plotting/contracts.py +176 -0
- processbehavior/plotting/control_chart.py +206 -0
- processbehavior/plotting/effects_charts.py +640 -0
- processbehavior/plotting/lane_boundaries.py +78 -0
- processbehavior/plotting/limits.py +157 -0
- processbehavior/plotting/maximum_information_chart.py +395 -0
- processbehavior/plotting/plotter.py +1469 -0
- processbehavior/plotting/renderers.py +660 -0
- processbehavior/plotting/report.py +211 -0
- processbehavior/plotting/residuals.py +282 -0
- processbehavior/plotting/run_rules_viz.py +150 -0
- processbehavior/plotting/stats_box.py +183 -0
- processbehavior/plotting/themes.py +544 -0
- processbehavior/plotting/x_axis_layout.py +474 -0
- processbehavior/plotting/zones.py +127 -0
- processbehavior/process_behavior.py +1290 -0
- processbehavior/py.typed +0 -0
- processbehavior/residual_calculator.py +572 -0
- processbehavior/result_signals.py +149 -0
- processbehavior/result_tabular.py +296 -0
- processbehavior/sds_detector.py +1432 -0
- processbehavior/signals/__init__.py +14 -0
- processbehavior/signals/config.py +435 -0
- processbehavior/signals/detector.py +328 -0
- processbehavior/signals/detectors.py +368 -0
- processbehavior/signals/result.py +232 -0
- processbehavior/spc_constants.py +692 -0
- processbehavior/study.py +2733 -0
- processbehavior/types.py +154 -0
- processbehavior-0.2.0.dist-info/METADATA +279 -0
- processbehavior-0.2.0.dist-info/RECORD +56 -0
- processbehavior-0.2.0.dist-info/WHEEL +4 -0
- processbehavior-0.2.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Named Calibration value objects — frozen mean/sigma for control-chart limits.
|
|
3
|
+
|
|
4
|
+
A ``Calibration`` lets an analyst pin a chart's limits to a known
|
|
5
|
+
("standards-given", in Wheeler's terms) mean and within-subgroup individual
|
|
6
|
+
standard deviation instead of estimating them from the data on hand. It mirrors
|
|
7
|
+
the value-object style of :class:`~processbehavior.capability.SpecLimits`, but
|
|
8
|
+
where ``SpecLimits`` feeds the capability histogram, a ``Calibration`` feeds the
|
|
9
|
+
control-chart limit machinery via ``study.execute(calibration=...)``.
|
|
10
|
+
|
|
11
|
+
Semantics (applied *forward* from the given individual sigma; the sigma is
|
|
12
|
+
never run back through c4/d2/b3/b4 to "recover" a process sigma):
|
|
13
|
+
|
|
14
|
+
- **Location charts** (X individuals, raw response, recentered residual, plain
|
|
15
|
+
residual) place limits constant-free in sigma: ``center ± n_sigma·sigma``
|
|
16
|
+
(Xbar divides the half-width by ``√N`` because it plots subgroup means).
|
|
17
|
+
- **Dispersion-statistic charts** (S, mR) necessarily carry their
|
|
18
|
+
sampling-distribution constants, because their y-axis is a dispersion
|
|
19
|
+
statistic, not sigma: S centers at ``c4(N)·sigma``; mR at ``d2(2)·sigma``.
|
|
20
|
+
|
|
21
|
+
References
|
|
22
|
+
----------
|
|
23
|
+
Wheeler, D. J. *Understanding Statistical Process Control* — standards-given
|
|
24
|
+
(known mean/sigma) limits.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
from __future__ import annotations
|
|
28
|
+
|
|
29
|
+
import math
|
|
30
|
+
from dataclasses import dataclass
|
|
31
|
+
|
|
32
|
+
from .exceptions import ValidationError
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@dataclass(frozen=True)
|
|
36
|
+
class Calibration:
|
|
37
|
+
"""A named, frozen ``(mean, sigma)`` pair for standards-given control limits.
|
|
38
|
+
|
|
39
|
+
Parameters
|
|
40
|
+
----------
|
|
41
|
+
label : str
|
|
42
|
+
Non-empty identifier used to key the calibration on a ``Study`` and to
|
|
43
|
+
select it by name in ``study.execute(calibration=...)``.
|
|
44
|
+
mean : float
|
|
45
|
+
The known process mean (center line) for location charts. Ignored for a
|
|
46
|
+
plain residual chart, whose center is fixed at 0.
|
|
47
|
+
sigma : float
|
|
48
|
+
The known within-subgroup standard deviation of **individual** values
|
|
49
|
+
(``> 0``). Used as-is; each chart shows the sampling distribution of the
|
|
50
|
+
statistic it plots, so an Xbar band is narrower by ``√N`` and an S chart
|
|
51
|
+
centers at ``c4(N)·sigma`` — both correct, neither a bug.
|
|
52
|
+
|
|
53
|
+
Examples
|
|
54
|
+
--------
|
|
55
|
+
>>> cal = Calibration(label='line-3 baseline', mean=10.0, sigma=0.5)
|
|
56
|
+
>>> cal.sigma
|
|
57
|
+
0.5
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
label: str
|
|
61
|
+
mean: float
|
|
62
|
+
sigma: float
|
|
63
|
+
|
|
64
|
+
def __post_init__(self) -> None:
|
|
65
|
+
if not self.label or not self.label.strip():
|
|
66
|
+
raise ValidationError('Calibration.label must be a non-empty string.')
|
|
67
|
+
if not math.isfinite(self.mean):
|
|
68
|
+
raise ValidationError(f'Calibration.mean must be finite, got {self.mean!r}.')
|
|
69
|
+
if not (math.isfinite(self.sigma) and self.sigma > 0):
|
|
70
|
+
raise ValidationError(f'Calibration.sigma must be finite and > 0, got {self.sigma!r}.')
|