Skip to content

SensorDriftEvents¤

Detect gradual calibration drift in inline sensors by tracking measurement behavior against reference values or historical baselines.

Module: ts_shape.events.quality.sensor_drift
Guide: Quality Control & SPC


When to Use¤

Use for continuous monitoring of inline sensor calibration. Detects gradual drift that may not trigger outlier alarms but degrades measurement accuracy over time. Ideal for pH probes, temperature sensors, pressure transmitters, and other instruments that require periodic calibration.


Quick Example¤

from ts_shape.events.quality.sensor_drift import SensorDriftEvents

drift = SensorDriftEvents(df, value_column="value_double")

# Track zero-point offset over 8-hour windows
zero = drift.detect_zero_drift(window="8h", threshold=None)

# Monitor sensitivity changes (span drift)
span = drift.detect_span_drift(window="8h")

# Get a composite calibration health score
health = drift.calibration_health(window="8h", tolerance=None)
print(health[["window_start", "health_score"]].head())

Key Methods¤

Method Purpose Returns
detect_zero_drift(window='8h', threshold=None) Track mean offset from baseline (zero-point drift) DataFrame with offset per window
detect_span_drift(window='8h') Detect sensitivity/gain changes over time DataFrame with span metrics per window
drift_trend(window='1D', metric='mean') Rolling trend of a chosen metric for visualization DataFrame with trend values
calibration_health(window='8h', tolerance=None) Composite health score combining zero and span drift DataFrame with health scores

Tips & Notes¤

Align windows with shift schedules

Use window='8h' to match typical manufacturing shifts. This makes it easy to correlate drift events with shift handovers and track which shifts see the most calibration degradation.

Related modules


See Also¤