ts_shape.events.quality.multi_sensor_validation
| Name | Description |
|---|---|
MultiSensorValidationEvents | Quality: Multi-Sensor Cross-Validation |
MultiSensorValidationEvents
MultiSensorValidationEvents(
dataframe: pd.DataFrame,
signal_uuids: list[str],
*,
value_column: str = "value_double",
event_uuid: str = "quality:multi_sensor",
time_column: str = "systime"
) -> None
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.
| Name | Description |
|---|---|
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 | Identify the sensor furthest from the group per window. |
| Name | Type | Description | Default |
|---|---|---|---|
dataframe | DataFrame | Long-format timeseries frame (one row per sample, uuid identifies the signal). | required |
signal_uuids | list[str] | UUIDs of the redundant sensors (at least two). | required |
value_column | str | Column holding the signal values. | 'value_double' |
event_uuid | str | UUID stamped on emitted events. | 'quality:multi_sensor' |
time_column | str | Timestamp column. | 'systime' |
sensor_uuids
sensor_uuids: list[str]
Deprecated alias of :attr:signal_uuids (read-only).
detect_disagreement
detect_disagreement(threshold: float, window: str = '5min') -> pd.DataFrame
Flag windows where sensor spread exceeds threshold.
| Name | Type | Description | Default |
|---|---|---|---|
threshold | float | Maximum acceptable spread (max - min) across sensors. | required |
window | str | Resample window size. | '5min' |
| Type | Description |
|---|---|
DataFrame | DataFrame with columns: start, end, duration_seconds, uuid, |
DataFrame | source_uuid, max_spread, sensor_high, sensor_low, duration. |
DataFrame | duration is a Timedelta; duration_seconds is the same |
DataFrame | span in float seconds. source_uuid is the comma-joined |
DataFrame | sensor uuids. |
pairwise_bias
pairwise_bias(window: str = '1h') -> pd.DataFrame
Mean difference between each sensor pair per window.
| Name | Type | Description | Default |
|---|---|---|---|
window | str | Resample window size. | '1h' |
| 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.
| Name | Type | Description | Default |
|---|---|---|---|
window | str | Resample window size. | '1h' |
| Type | Description |
|---|---|
DataFrame | DataFrame with columns: start, end, duration_seconds, uuid, |
DataFrame | source_uuid, consensus_mean, spread_std, consensus_score. |
DataFrame | end is start plus one window; source_uuid is the |
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.
| Name | Type | Description | Default |
|---|---|---|---|
window | str | Resample window size. | '1h' |
method | str | 'median' or 'mean' — central tendency for comparison. | 'median' |
| Type | Description |
|---|---|
DataFrame | DataFrame with columns: start, outlier_sensor, |
DataFrame | deviation, other_sensors_mean. |