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.
Files changed (56) hide show
  1. processbehavior/__init__.py +133 -0
  2. processbehavior/analysis.py +2944 -0
  3. processbehavior/analysis_dataset.py +361 -0
  4. processbehavior/analysis_result.py +1276 -0
  5. processbehavior/calibration.py +70 -0
  6. processbehavior/capability.py +720 -0
  7. processbehavior/data_preparation.py +792 -0
  8. processbehavior/datasets/__init__.py +37 -0
  9. processbehavior/datasets/data/coffee_shop_demo_long.csv +385 -0
  10. processbehavior/datasets/loaders.py +66 -0
  11. processbehavior/datasets/synthetic.py +1711 -0
  12. processbehavior/derivations.py +602 -0
  13. processbehavior/effects_calculator.py +603 -0
  14. processbehavior/exceptions.py +216 -0
  15. processbehavior/exporters/__init__.py +5 -0
  16. processbehavior/exporters/excel_exporter.py +708 -0
  17. processbehavior/focused_result.py +329 -0
  18. processbehavior/formulation_spec.py +144 -0
  19. processbehavior/loss_function.py +517 -0
  20. processbehavior/maximum_information.py +285 -0
  21. processbehavior/plotting/__init__.py +46 -0
  22. processbehavior/plotting/_math.py +121 -0
  23. processbehavior/plotting/capability_chart.py +858 -0
  24. processbehavior/plotting/contracts.py +176 -0
  25. processbehavior/plotting/control_chart.py +206 -0
  26. processbehavior/plotting/effects_charts.py +640 -0
  27. processbehavior/plotting/lane_boundaries.py +78 -0
  28. processbehavior/plotting/limits.py +157 -0
  29. processbehavior/plotting/maximum_information_chart.py +395 -0
  30. processbehavior/plotting/plotter.py +1469 -0
  31. processbehavior/plotting/renderers.py +660 -0
  32. processbehavior/plotting/report.py +211 -0
  33. processbehavior/plotting/residuals.py +282 -0
  34. processbehavior/plotting/run_rules_viz.py +150 -0
  35. processbehavior/plotting/stats_box.py +183 -0
  36. processbehavior/plotting/themes.py +544 -0
  37. processbehavior/plotting/x_axis_layout.py +474 -0
  38. processbehavior/plotting/zones.py +127 -0
  39. processbehavior/process_behavior.py +1290 -0
  40. processbehavior/py.typed +0 -0
  41. processbehavior/residual_calculator.py +572 -0
  42. processbehavior/result_signals.py +149 -0
  43. processbehavior/result_tabular.py +296 -0
  44. processbehavior/sds_detector.py +1432 -0
  45. processbehavior/signals/__init__.py +14 -0
  46. processbehavior/signals/config.py +435 -0
  47. processbehavior/signals/detector.py +328 -0
  48. processbehavior/signals/detectors.py +368 -0
  49. processbehavior/signals/result.py +232 -0
  50. processbehavior/spc_constants.py +692 -0
  51. processbehavior/study.py +2733 -0
  52. processbehavior/types.py +154 -0
  53. processbehavior-0.2.0.dist-info/METADATA +279 -0
  54. processbehavior-0.2.0.dist-info/RECORD +56 -0
  55. processbehavior-0.2.0.dist-info/WHEEL +4 -0
  56. 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}.')