processbehavior 0.3.2__py3-none-any.whl → 0.3.3__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.
@@ -47,7 +47,7 @@ its ``.sds`` field. Internally some modules still use the legacy "SDS"
47
47
  prefix (e.g. ``sds_detector.py``); the model itself is three-state.
48
48
  """
49
49
 
50
- __version__ = '0.3.2'
50
+ __version__ = '0.3.3'
51
51
 
52
52
  # Result object
53
53
  from processbehavior.analysis_result import AnalysisResult
@@ -21,7 +21,7 @@ import numpy as np
21
21
  import pandas as pd
22
22
 
23
23
  from .exceptions import ValidationError
24
- from .spc_constants import R_UPPER_LIMIT_MULTIPLIER, XMR_LIMIT_MULTIPLIER
24
+ from .spc_constants import D2_N2, R_UPPER_LIMIT_MULTIPLIER, XMR_LIMIT_MULTIPLIER
25
25
 
26
26
  if TYPE_CHECKING:
27
27
  from .analysis_dataset import AnalysisDataSet
@@ -48,9 +48,9 @@ class MaximumInformationResult:
48
48
  sigma_hat : float
49
49
  mR / d2 — noise floor sigma estimate.
50
50
  upl : float
51
- Upper natural process limit (R2 mean + 2.66 * mR).
51
+ Upper natural process limit (R2 mean + E2 * mR, E2 = 3/1.128 ≈ 2.66).
52
52
  lpl : float
53
- Lower natural process limit (R2 mean - 2.66 * mR).
53
+ Lower natural process limit (R2 mean - E2 * mR).
54
54
  n_signals : int
55
55
  Points beyond limits on XmR.
56
56
  round_to : int
@@ -159,9 +159,6 @@ class MaximumInformationResult:
159
159
  # Pure Function
160
160
  # ============================================================================
161
161
 
162
- # d2 for n=2 (moving range of consecutive pairs)
163
- _D2 = 1.128
164
-
165
162
 
166
163
  def assess_maximum_information(
167
164
  ads: AnalysisDataSet,
@@ -204,7 +201,7 @@ def assess_maximum_information(
204
201
  r2_mean = float(np.mean(r2_values))
205
202
  mr_values = np.abs(np.diff(r2_values))
206
203
  r2_mR = float(np.mean(mr_values))
207
- sigma_hat = r2_mR / _D2
204
+ sigma_hat = r2_mR / D2_N2
208
205
 
209
206
  # Limits: mean ± E2 * mR
210
207
  upl = r2_mean + XMR_LIMIT_MULTIPLIER * r2_mR
@@ -29,15 +29,19 @@ from .exceptions import ValidationError
29
29
  # Control limit multiplier (3-sigma limits are standard in SPC)
30
30
  SIGMA_MULTIPLIER = 3
31
31
 
32
- # E2 constant for XmR charts (n=2, moving range of 2 consecutive observations)
33
- # Used for calculating control limits on individual values
34
- # E2 = d2 / d3 for n=2, where d2 = 1.128 and d3 = 0.8525
35
- XMR_LIMIT_MULTIPLIER = 2.66
32
+ # Moving-range constants for n = 2 (consecutive pairs), as in Bishop's VAS manual:
33
+ # sigma = mR / d2 (Eq 12.4), X limits = X ± 3·mR/d2 (Eq 12.10-12.11), and the
34
+ # moving-range upper limit = (1 + 3·d3/d2)·mR (Eq 12.5). The manual prints the
35
+ # rounded values 2.66 and 3.268; Bishop's VAS software computes them from d2 and
36
+ # d3 without rounding, and so does this library.
37
+ D2_N2 = 1.128
38
+ D3_N2 = 0.8525
36
39
 
37
- # D4 constant for R charts (n=2, range of 2 consecutive observations)
38
- # Used for upper control limit on moving range
39
- # D4 = 1 + 3(d3/d2) for n=2
40
- R_UPPER_LIMIT_MULTIPLIER = 3.268
40
+ # E2 for XmR charts: X ± E2·mR, E2 = 3/d2 (≈ 2.66)
41
+ XMR_LIMIT_MULTIPLIER = SIGMA_MULTIPLIER / D2_N2
42
+
43
+ # D4 for the moving-range chart: upper limit = D4·mR, D4 = 1 + 3·d3/d2 (≈ 3.267)
44
+ R_UPPER_LIMIT_MULTIPLIER = 1 + SIGMA_MULTIPLIER * D3_N2 / D2_N2
41
45
 
42
46
 
43
47
  # ============================================================================
@@ -260,8 +264,8 @@ def calculate_limits(
260
264
  -----
261
265
  Xbar limits: X̄ ± (3 * Wd) / sqrt(n), where Wd = S / c4(n)
262
266
  S limits: S * b3(n) to S * b4(n)
263
- XmR limits: X̄ ± (E2 * mR), where E2 = 2.66
264
- R limits: 0 to mR * D4, where D4 = 3.268
267
+ XmR limits: X̄ ± (E2 * mR), where E2 = 3/d2 = 3/1.128 (≈ 2.66)
268
+ R limits: 0 to mR * D4, where D4 = 1 + 3·d3/d2 = 1 + 3(0.8525)/1.128 (≈ 3.267)
265
269
 
266
270
  References
267
271
  ----------
@@ -414,11 +418,8 @@ def calculate_limits_vectorized(
414
418
  return pd.DataFrame({'lpl': lpl, 'upl': upl}, index=index)
415
419
 
416
420
 
417
- # d2 bias constant for the n=2 moving range, derived from the library's own E2
418
- # (E2 = sigma_multiplier / d2 at n=2, with the default 3-sigma multiplier). Used
419
- # only on the calibration path so calibrated X/mR limits stay internally
420
- # consistent with the data-path XmR/R constants.
421
- D2_N2 = 3.0 / XMR_LIMIT_MULTIPLIER
421
+ # calibrated_limits uses D2_N2 (defined with the XmR constants above), so
422
+ # calibrated X/mR limits stay consistent with the data-path XmR/R constants.
422
423
 
423
424
 
424
425
  def calibrated_limits(
@@ -714,12 +715,12 @@ MR_SIGMA_INTERVAL_80: dict[int, tuple[float, float]] = {
714
715
  9: (0.618, 1.418),
715
716
  10: (0.637, 1.396),
716
717
  11: (0.656, 1.375),
717
- 12: (0.670, 1.360),
718
+ 12: (0.670, 1.359),
718
719
  13: (0.680, 1.344),
719
- 14: (0.694, 1.330),
720
+ 14: (0.694, 1.329),
720
721
  15: (0.703, 1.315),
721
722
  16: (0.714, 1.310),
722
- 17: (0.722, 1.300),
723
+ 17: (0.721, 1.300),
723
724
  18: (0.730, 1.288),
724
725
  19: (0.739, 1.280),
725
726
  20: (0.745, 1.274),
@@ -728,9 +729,9 @@ MR_SIGMA_INTERVAL_80: dict[int, tuple[float, float]] = {
728
729
  23: (0.761, 1.253),
729
730
  24: (0.766, 1.249),
730
731
  25: (0.771, 1.243),
731
- 26: (0.775, 1.238),
732
+ 26: (0.774, 1.238),
732
733
  27: (0.780, 1.234),
733
734
  28: (0.784, 1.229),
734
- 29: (0.787, 1.224),
735
+ 29: (0.787, 1.223),
735
736
  30: (0.790, 1.220),
736
737
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: processbehavior
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: Python-native Process Behavior & Control Charts (spec-driven SPC with tidy outputs)
5
5
  Project-URL: Homepage, https://github.com/cnicholas/processbehavior
6
6
  Project-URL: Repository, https://github.com/cnicholas/processbehavior
@@ -1,4 +1,4 @@
1
- processbehavior/__init__.py,sha256=JUdIuSX3gtDfzmKThhDNoJsikoWFUsY2_c4VW6j6M1E,4097
1
+ processbehavior/__init__.py,sha256=mxdMzPX_mDDJoCArd-gN1aNxFOcgD3NGyQoHSSiwDNI,4097
2
2
  processbehavior/analysis.py,sha256=huEz6DxbAqgduuVYZKnijnJtrhLkvqmtOYClZX3iIJo,117738
3
3
  processbehavior/analysis_dataset.py,sha256=xnbG4oVZADIJrKPNMcdvqocRtKWf5gWORS3JngTCS-g,15029
4
4
  processbehavior/analysis_result.py,sha256=8pyCRUtBocw1j6MdDtZg4x0ypjv3NI5KK3oiluOCl0M,46447
@@ -11,7 +11,7 @@ processbehavior/exceptions.py,sha256=Xxe_CMGcl7-B7tqfCpzrSc72RgixBTeXYK181-8arBg
11
11
  processbehavior/focused_result.py,sha256=0IAUXvp1iD_uQy_ol4LnxeYu9yGO67IWsUYwLJdpHFE,12637
12
12
  processbehavior/formulation_spec.py,sha256=rnwxpy5Ms10NDuQbim4GUtsmjkdhaWMC_TzYT7T-nbw,4725
13
13
  processbehavior/loss_function.py,sha256=xyC2R35u3sKS1cAk0zUoDbDT3UhJRorL77QRQliax7k,16571
14
- processbehavior/maximum_information.py,sha256=UWj_Nw34XN1CuUF8OwbrbykSRtaz_aSL4EXoiRxs_Vo,7964
14
+ processbehavior/maximum_information.py,sha256=cCfnJdxCuTxL-cXuZ5F8u98yoBkhzNLoRaDHVnSL_LM,7930
15
15
  processbehavior/process_behavior.py,sha256=YV_XJtZyUQZw9Y5wBa5CXAGpDr9wvbkHOEr3W0fYm24,51327
16
16
  processbehavior/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  processbehavior/residual_calculator.py,sha256=wTuaO7uqpXnrJfHdMOHK53gTZlGrgRWP242FJhyW8As,18627
@@ -19,7 +19,7 @@ processbehavior/result_signals.py,sha256=i4FI5VWkVREU-tEzX-JVoDinpf009MKq41GwALU
19
19
  processbehavior/result_tabular.py,sha256=DQdvAqEjTY8v4cSP3xpeLcczL9DH32wW7s99qfnPe8c,10796
20
20
  processbehavior/sds_detector.py,sha256=UC5kHs41bZNm7SgYH2n6mMXqkASdb6qV39gTcRJBuCM,53510
21
21
  processbehavior/series_length.py,sha256=fKZmT9_NYUKe-6a3rb2wmS6MaWie3d6pGcnpsQgo_bs,3948
22
- processbehavior/spc_constants.py,sha256=z8x66slzfjQb2bVjB5SE6CMsgUsgbfQSJ98h-xJjsQE,26019
22
+ processbehavior/spc_constants.py,sha256=Eh03CDQO-2gWjyQSycaL5v2Pjais1Y_NXe1OSHW6AXs,26170
23
23
  processbehavior/study.py,sha256=H4YVIkvsK0pUlvm-itj2WJlpkRupYNNQOTncDCFgiq8,109680
24
24
  processbehavior/types.py,sha256=WjDDSQMrH6SzZfQwgXIWdvpb823DXQ_HsTQz_8Sw-g4,5015
25
25
  processbehavior/datasets/__init__.py,sha256=O3JeBxTL9mS5AsZDJ0-AuMMksig2k55JrT3l4LAT7Jw,444
@@ -51,7 +51,7 @@ processbehavior/signals/config.py,sha256=H0NuegArh5_fUB5rdB7qY_eEBaTGkq6xDbO7C9T
51
51
  processbehavior/signals/detector.py,sha256=_IY9mZGgV__C0tljMrRa-74fTj_kHLb7xZsUd5bf4ms,14110
52
52
  processbehavior/signals/detectors.py,sha256=ia-LHfS4fKkN4DZ2kZBvc_Z04em-FoVGu9xB09VuMVU,10203
53
53
  processbehavior/signals/result.py,sha256=Q_bsjGego7CQrNN0HhWrcQbb4intGb7Y5gkvk1EtAlY,10369
54
- processbehavior-0.3.2.dist-info/METADATA,sha256=91yMKkGJPGhVxhKQl-Ki16GCDbSErc5y8hg_b2ZdaCw,13515
55
- processbehavior-0.3.2.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
56
- processbehavior-0.3.2.dist-info/licenses/LICENSE,sha256=GgI9nWoMCj2vWn2iisJHcHK_uYHWZ76s9jRsedoO_Wc,11281
57
- processbehavior-0.3.2.dist-info/RECORD,,
54
+ processbehavior-0.3.3.dist-info/METADATA,sha256=c4WDJUrPVvgZAXts38m2CuxcqTz7KnSVZhkAeVh0UYg,13515
55
+ processbehavior-0.3.3.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
56
+ processbehavior-0.3.3.dist-info/licenses/LICENSE,sha256=GgI9nWoMCj2vWn2iisJHcHK_uYHWZ76s9jRsedoO_Wc,11281
57
+ processbehavior-0.3.3.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.32.0
2
+ Generator: hatchling 1.32.4
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any