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,133 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ProcessBehavior - Statistical Process Control for Python
|
|
3
|
+
|
|
4
|
+
A Pythonic library for process behavior analysis following Bishop's
|
|
5
|
+
Variance Analysis System (VAS). The library models the data lifecycle
|
|
6
|
+
through three design states and routes analysis by what your data
|
|
7
|
+
actually supports:
|
|
8
|
+
|
|
9
|
+
- **Planned Design State (PDS)** — what you intended to collect
|
|
10
|
+
- **Observed Design State (ODS)** — what was actually collected (raw data)
|
|
11
|
+
- **Analytical Design State (ADS)** — what survives tidying and drives
|
|
12
|
+
chart selection, residual availability, and variance decomposition
|
|
13
|
+
|
|
14
|
+
Quick Start
|
|
15
|
+
-----------
|
|
16
|
+
import processbehavior as pb
|
|
17
|
+
|
|
18
|
+
# Generate sample data (or supply your own DataFrame)
|
|
19
|
+
df = pb.make_design(state=1, seed=42)
|
|
20
|
+
|
|
21
|
+
# Formulate the study (detects PDS / ODS / ADS, builds analysis dataset)
|
|
22
|
+
study = pb.formulate(df, response='y', time='time', factors=['factor 1', 'factor 2'])
|
|
23
|
+
print(f"Observed: ODS {study.observed_design_state.sds}")
|
|
24
|
+
print(f"Analytical: ADS {study.analytical_design_state.sds}")
|
|
25
|
+
print(f"Recommended chart: {study.recommended_chart}")
|
|
26
|
+
|
|
27
|
+
# Execute analysis (routes by ADS)
|
|
28
|
+
result = study.execute()
|
|
29
|
+
stats = result.get_statistics('Xbar')
|
|
30
|
+
print(f"Center: {stats['center']}, UPL: {stats['upl']}")
|
|
31
|
+
|
|
32
|
+
# Export to Excel (requires the [excel] extra)
|
|
33
|
+
result.to_excel('analysis.xlsx')
|
|
34
|
+
|
|
35
|
+
Main Classes
|
|
36
|
+
------------
|
|
37
|
+
ProcessBehavior : Main user-facing API with auto-completion
|
|
38
|
+
Study : Formulated study carrying PDS / ODS / ADS lineage
|
|
39
|
+
DesignReport : Plan-vs-observed-vs-analytical lineage report
|
|
40
|
+
AnalysisResult : Unified result container
|
|
41
|
+
|
|
42
|
+
A Note on Terminology
|
|
43
|
+
---------------------
|
|
44
|
+
The integer codes 1-6 are Bishop's reference scale ("Bishop Table 1").
|
|
45
|
+
Each design state - PDS, ODS, or ADS - reports a value on that scale via
|
|
46
|
+
its ``.sds`` field. Internally some modules still use the legacy "SDS"
|
|
47
|
+
prefix (e.g. ``sds_detector.py``); the model itself is three-state.
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
__version__ = '0.2.0'
|
|
51
|
+
|
|
52
|
+
# Result object
|
|
53
|
+
from processbehavior.analysis_result import AnalysisResult
|
|
54
|
+
from processbehavior.calibration import Calibration
|
|
55
|
+
from processbehavior.capability import CapabilityResult, SpecLimits
|
|
56
|
+
from processbehavior.datasets.loaders import load_coffee_shop
|
|
57
|
+
from processbehavior.datasets.synthetic import make_design
|
|
58
|
+
|
|
59
|
+
# Derived variables (transforms + binning)
|
|
60
|
+
from processbehavior.derivations import (
|
|
61
|
+
Derivation,
|
|
62
|
+
EvalResult,
|
|
63
|
+
ValidationResult,
|
|
64
|
+
derivations,
|
|
65
|
+
evaluate,
|
|
66
|
+
remove_derived,
|
|
67
|
+
replace_derived,
|
|
68
|
+
validate,
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
# Exceptions
|
|
72
|
+
from processbehavior.exceptions import (
|
|
73
|
+
CalibrationNotSupportedError,
|
|
74
|
+
ChartNotAvailableError,
|
|
75
|
+
ColumnNotFoundError,
|
|
76
|
+
FactorNotFoundError,
|
|
77
|
+
ProcessBehaviorError,
|
|
78
|
+
ProcessBehaviorWarning,
|
|
79
|
+
ValidationError,
|
|
80
|
+
)
|
|
81
|
+
from processbehavior.loss_function import LossResult
|
|
82
|
+
from processbehavior.maximum_information import MaximumInformationResult
|
|
83
|
+
|
|
84
|
+
# Plotting/theming
|
|
85
|
+
from processbehavior.plotting import ChartTheme, get_theme, list_themes, register_theme
|
|
86
|
+
from processbehavior.process_behavior import ColumnRef, ProcessBehavior, formulate
|
|
87
|
+
|
|
88
|
+
# Design-state lineage type (re-exported for type-hint use)
|
|
89
|
+
from processbehavior.sds_detector import SDSResult
|
|
90
|
+
|
|
91
|
+
# Study class (formulation layer)
|
|
92
|
+
from processbehavior.study import DesignReport, Study
|
|
93
|
+
|
|
94
|
+
__all__ = [
|
|
95
|
+
# Main API
|
|
96
|
+
'ProcessBehavior',
|
|
97
|
+
'formulate',
|
|
98
|
+
'ColumnRef',
|
|
99
|
+
'Study',
|
|
100
|
+
'DesignReport',
|
|
101
|
+
'SDSResult',
|
|
102
|
+
'AnalysisResult',
|
|
103
|
+
'SpecLimits',
|
|
104
|
+
'Calibration',
|
|
105
|
+
'CapabilityResult',
|
|
106
|
+
'LossResult',
|
|
107
|
+
'MaximumInformationResult',
|
|
108
|
+
# Derived variables
|
|
109
|
+
'Derivation',
|
|
110
|
+
'EvalResult',
|
|
111
|
+
'ValidationResult',
|
|
112
|
+
'evaluate',
|
|
113
|
+
'validate',
|
|
114
|
+
'derivations',
|
|
115
|
+
'remove_derived',
|
|
116
|
+
'replace_derived',
|
|
117
|
+
# Exceptions
|
|
118
|
+
'ProcessBehaviorError',
|
|
119
|
+
'ValidationError',
|
|
120
|
+
'ColumnNotFoundError',
|
|
121
|
+
'FactorNotFoundError',
|
|
122
|
+
'ChartNotAvailableError',
|
|
123
|
+
'CalibrationNotSupportedError',
|
|
124
|
+
'ProcessBehaviorWarning',
|
|
125
|
+
# Plotting/theming
|
|
126
|
+
'ChartTheme',
|
|
127
|
+
'get_theme',
|
|
128
|
+
'list_themes',
|
|
129
|
+
'register_theme',
|
|
130
|
+
# Datasets
|
|
131
|
+
'make_design',
|
|
132
|
+
'load_coffee_shop',
|
|
133
|
+
]
|