Skip to main content
Version: Next

ts_shape.events.quality.multi_sensor_validation

Classes
NameDescription
MultiSensorValidationEventsQuality: Multi-Sensor Cross-Validation

MultiSensorValidationEvents​

classsource
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.
Functions
NameDescription
detect_disagreementFlag windows where sensor spread exceeds threshold.
pairwise_biasMean difference between each sensor pair per window.
consensus_scorePer-window measurement consensus across sensors.
detect_outlier_sensorIdentify the sensor furthest from the group per window.
Parameters
NameTypeDescriptionDefault
dataframeDataFrameLong-format timeseries frame (one row per sample, uuid identifies the signal).required
signal_uuidslist[str]UUIDs of the redundant sensors (at least two).required
value_columnstrColumn holding the signal values.'value_double'
event_uuidstrUUID stamped on emitted events.'quality:multi_sensor'
time_columnstrTimestamp column.'systime'

sensor_uuids​

propertysource
sensor_uuids: list[str]

Deprecated alias of :attr:signal_uuids (read-only).

detect_disagreement​

methodsource
detect_disagreement(threshold: float, window: str = '5min') -> pd.DataFrame

Flag windows where sensor spread exceeds threshold.

Parameters
NameTypeDescriptionDefault
thresholdfloatMaximum acceptable spread (max - min) across sensors.required
windowstrResample window size.'5min'
Returns
TypeDescription
DataFrameDataFrame with columns: start, end, duration_seconds, uuid,
DataFramesource_uuid, max_spread, sensor_high, sensor_low, duration.
DataFrameduration is a Timedelta; duration_seconds is the same
DataFramespan in float seconds. source_uuid is the comma-joined
DataFramesensor uuids.

pairwise_bias​

methodsource
pairwise_bias(window: str = '1h') -> pd.DataFrame

Mean difference between each sensor pair per window.

Parameters
NameTypeDescriptionDefault
windowstrResample window size.'1h'
Returns
TypeDescription
DataFrameDataFrame with columns: start, sensor_a, sensor_b,
DataFramebias, abs_bias.

consensus_score​

methodsource
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
NameTypeDescriptionDefault
windowstrResample window size.'1h'
Returns
TypeDescription
DataFrameDataFrame with columns: start, end, duration_seconds, uuid,
DataFramesource_uuid, consensus_mean, spread_std, consensus_score.
DataFrameend is start plus one window; source_uuid is the
DataFramecomma-joined sensor uuids.

detect_outlier_sensor​

methodsource
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
NameTypeDescriptionDefault
windowstrResample window size.'1h'
methodstr'median' or 'mean' — central tendency for comparison.'median'
Returns
TypeDescription
DataFrameDataFrame with columns: start, outlier_sensor,
DataFramedeviation, other_sensors_mean.