multi_sensor_validation
multi_sensor_validation ¤
MultiSensorValidationEvents ¤
MultiSensorValidationEvents(
dataframe: DataFrame,
signal_uuids: list[str],
*,
value_column: str = "value_double",
event_uuid: str = "quality:multi_sensor",
time_column: str = "systime"
)
Bases: Base
Quality: Multi-Sensor Cross-Validation
Cross-validate redundant inline sensors measuring the same process variable. Detects disagreement, identifies drifting sensors, and assesses measurement consensus.
Methods:
- detect_disagreement: Flag windows where sensor spread exceeds threshold.
- pairwise_bias: Mean difference between each sensor pair per window.
- consensus_score: Per-window measurement consensus across sensors.
- detect_outlier_sensor: Find the sensor furthest from the group.
- sensor_uuids: Deprecated read-only alias of signal_uuids.
detect_disagreement ¤
detect_disagreement(
threshold: float, window: str = "5min"
) -> pd.DataFrame
Flag windows where sensor spread exceeds threshold.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold
|
float
|
Maximum acceptable spread (max - min) across sensors. |
required |
window
|
str
|
Resample window size. |
'5min'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns: start, end, duration_seconds, uuid, |
DataFrame
|
source_uuid, max_spread, sensor_high, sensor_low, duration. |
DataFrame
|
|
DataFrame
|
span in float seconds. |
DataFrame
|
sensor uuids. |
pairwise_bias ¤
pairwise_bias(window: str = '1h') -> pd.DataFrame
Mean difference between each sensor pair per window.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
window
|
str
|
Resample window size. |
'1h'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns: start, sensor_a, sensor_b, |
DataFrame
|
bias, abs_bias. |
consensus_score ¤
consensus_score(window: str = '1h') -> pd.DataFrame
Per-window measurement consensus across sensors.
Score = 1.0 means perfect agreement, 0.0 means high disagreement.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
window
|
str
|
Resample window size. |
'1h'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns: start, end, duration_seconds, uuid, |
DataFrame
|
source_uuid, consensus_mean, spread_std, consensus_score. |
DataFrame
|
|
DataFrame
|
comma-joined sensor uuids. |
detect_outlier_sensor ¤
detect_outlier_sensor(
window: str = "1h", method: str = "median"
) -> pd.DataFrame
Identify the sensor furthest from the group per window.
Telling which sensor is off needs at least three: with two, each is
as far from the other as the other is from it. Windows with fewer
than three sensors reporting are skipped with one
:class:~ts_shape.errors.DataQualityWarning. When several sensors are
equally far from the center, the first one in signal_uuids wins.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
window
|
str
|
Resample window size. |
'1h'
|
method
|
str
|
'median' or 'mean' — central tendency for comparison. |
'median'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns: start, outlier_sensor, |
DataFrame
|
deviation, other_sensors_mean. |