Statistical constants are hard-coded throughout the code with no explanation or source citations.
Examples
- Line 1697:
2.66 (IMR limit multiplier)
- Line 1705:
3.268 (R chart limit multiplier)
- Line 299-300: beyond_limits calculation logic
- Various uses of
3 for sigma multipliers
Impact
- Hard to verify correctness
- No documentation of where constants come from
- Hard to modify if different sigma levels needed
Fix
Define named constants at module level with docstrings:
# Statistical constants based on d2 and d3 tables
IMR_LIMIT_MULTIPLIER = 2.66 # E2 constant for n=2 (individuals)
R_LIMIT_MULTIPLIER = 3.268 # D4 constant for n=2 (moving range)
SIGMA_MULTIPLIER = 3 # Standard 3-sigma control limits
Files
analysis_dataset.py
objects.py
Statistical constants are hard-coded throughout the code with no explanation or source citations.
Examples
2.66(IMR limit multiplier)3.268(R chart limit multiplier)3for sigma multipliersImpact
Fix
Define named constants at module level with docstrings:
Files
analysis_dataset.pyobjects.py