signal_comparison
signal_comparison ¤
SignalComparisonEvents ¤
SignalComparisonEvents(
dataframe: DataFrame,
reference_uuid: str,
*,
event_uuid: str = "eng:signal_comparison",
value_column: str = "value_double",
time_column: str = "systime"
)
Bases: Base
Engineering: Signal Comparison
Compare two related signals (e.g. setpoint vs actual, sensor A vs sensor B) and detect divergence, compute deviation statistics, and track correlation.
Methods: - detect_divergence: Intervals where |actual - reference| exceeds tolerance. - deviation_statistics: Per-window MAE, max error, RMSE, bias. - tracking_error_trend: Whether deviation is growing or shrinking over time. - correlation_windows: Per-window Pearson correlation.
detect_divergence ¤
detect_divergence(
actual_uuid: str,
tolerance: float,
min_duration: str = "1min",
) -> pd.DataFrame
Detect intervals where |actual - reference| > tolerance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
actual_uuid
|
str
|
UUID of the actual/comparison signal. |
required |
tolerance
|
float
|
Maximum acceptable absolute deviation. |
required |
min_duration
|
str
|
Minimum duration of divergence interval. |
'1min'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns: start, end, duration_seconds, uuid, |
DataFrame
|
source_uuid (reference and actual uuids, comma-joined), is_delta, |
DataFrame
|
max_deviation, mean_deviation, direction. |
deviation_statistics ¤
deviation_statistics(
actual_uuid: str, window: str = "1h"
) -> pd.DataFrame
Per-window deviation statistics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
actual_uuid
|
str
|
UUID of the actual signal compared with the reference signal. Deviation is actual minus reference. |
required |
window
|
str
|
Resample window (pandas offset string, e.g. '1h'). |
'1h'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns: start, end, duration_seconds, mae, |
DataFrame
|
max_error, rmse, bias. |
tracking_error_trend ¤
tracking_error_trend(
actual_uuid: str, window: str = "1D"
) -> pd.DataFrame
Track whether deviation is growing or shrinking over time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
actual_uuid
|
str
|
UUID of the actual signal compared with the reference signal. |
required |
window
|
str
|
Resample window passed to :meth: |
'1D'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns: start, end, duration_seconds, mae, |
DataFrame
|
trend_slope, trend_direction. |
correlation_windows ¤
correlation_windows(
actual_uuid: str, window: str = "1h"
) -> pd.DataFrame
Per-window Pearson correlation between reference and actual.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
actual_uuid
|
str
|
UUID of the actual signal compared with the reference signal. |
required |
window
|
str
|
Resample window (pandas offset string). Windows with fewer than two aligned samples are skipped. |
'1h'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns: start, end, duration_seconds, |
DataFrame
|
correlation, sample_count. |