sensor_drift
sensor_drift ¤
SensorDriftEvents ¤
SensorDriftEvents(
dataframe: DataFrame,
signal_uuid: str,
*,
reference_uuid: Optional[str] = None,
reference_value: Optional[float] = None,
value_column: str = "value_double",
event_uuid: str = "quality:sensor_drift",
time_column: str = "systime"
)
Bases: Base
Quality: Sensor Calibration Drift Detection
Detect gradual calibration drift in inline sensors by tracking measurement behavior against reference values or historical baselines.
Reference can be provided as a UUID (time-aligned signal in the DataFrame) or as a fixed float value.
Methods: - detect_zero_drift: Track mean offset from baseline per window. - detect_span_drift: Track measurement sensitivity changes over time. - drift_trend: Rolling linear trend analysis on signal statistics. - calibration_health: Composite health score per window.
detect_zero_drift ¤
detect_zero_drift(
window: str = "8h", threshold: Optional[float] = None
) -> pd.DataFrame
Track mean offset from baseline per window.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
window
|
str
|
Resample window size. |
'8h'
|
threshold
|
Optional[float]
|
Offset threshold for severity. Auto-calculated as 3x std of first window if not provided. |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns: window_start, window_end, mean_offset, |
DataFrame
|
drift_rate, severity. |
detect_span_drift ¤
detect_span_drift(window: str = '8h') -> pd.DataFrame
Track measurement sensitivity changes over time.
Requires reference_uuid or reference_value. Computes ratio of signal mean to reference per window to detect gain/span changes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
window
|
str
|
Resample window size. |
'8h'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns: window_start, sensitivity, |
DataFrame
|
sensitivity_change_pct. |
drift_trend ¤
drift_trend(
window: str = "1D", metric: str = "mean"
) -> pd.DataFrame
Rolling trend analysis on signal statistics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
window
|
str
|
Resample window size. |
'1D'
|
metric
|
str
|
Statistic to trend ('mean' or 'std'). |
'mean'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns: window_start, value, slope, |
DataFrame
|
r_squared, direction. |
calibration_health ¤
calibration_health(
window: str = "8h", tolerance: Optional[float] = None
) -> pd.DataFrame
Composite calibration health score per window.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
window
|
str
|
Resample window size. |
'8h'
|
tolerance
|
Optional[float]
|
Acceptable measurement tolerance. Used to normalize bias and precision into a 0-100 score. |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns: window_start, bias, precision, |
DataFrame
|
health_score. |