signal_correlation
signal_correlation ¤
SignalCorrelationEvents ¤
SignalCorrelationEvents(
dataframe: DataFrame,
*,
event_uuid: str = "corr:signal",
value_column: str = "value_double",
time_column: str = "systime"
)
Bases: Base
Correlation: Signal Correlation Analysis
Analyze time-windowed correlations between pairs of numeric signals. Useful for detecting when normally correlated process variables diverge.
Methods: - rolling_correlation: Pearson correlation over rolling windows. - correlation_breakdown: Detect periods where correlation drops below threshold. - lag_correlation: Cross-correlation with time lag to find delayed relationships.
rolling_correlation ¤
rolling_correlation(
uuid_a: str,
uuid_b: str,
*,
resample: str = "1min",
window: int = 60
) -> pd.DataFrame
Compute rolling Pearson correlation between two signals.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
uuid_a
|
str
|
UUID of first signal. |
required |
uuid_b
|
str
|
UUID of second signal. |
required |
resample
|
str
|
Resample interval for alignment. |
'1min'
|
window
|
int
|
Rolling window size (in resampled periods). |
60
|
Returns:
| Name | Type | Description |
|---|---|---|
DataFrame |
DataFrame
|
systime, uuid, source_uuid_a, source_uuid_b, is_delta, correlation |
correlation_breakdown ¤
correlation_breakdown(
uuid_a: str,
uuid_b: str,
*,
resample: str = "1min",
window: int = 60,
threshold: float = 0.5
) -> pd.DataFrame
Detect periods where correlation drops below a threshold.
Returns intervals where previously correlated signals diverge, which may indicate process issues.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
uuid_a
|
str
|
UUID of first signal. |
required |
uuid_b
|
str
|
UUID of second signal. |
required |
resample
|
str
|
Resample interval for alignment. |
'1min'
|
window
|
int
|
Rolling window size. |
60
|
threshold
|
float
|
Correlation threshold below which to flag. |
0.5
|
Returns:
| Name | Type | Description |
|---|---|---|
DataFrame |
DataFrame
|
start, end, uuid, source_uuid_a, source_uuid_b, is_delta, min_correlation, duration_seconds |
lag_correlation ¤
lag_correlation(
uuid_a: str,
uuid_b: str,
*,
resample: str = "1min",
max_lag: int = 30
) -> pd.DataFrame
Cross-correlation with time lag analysis.
Finds the time lag at which two signals are most correlated.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
uuid_a
|
str
|
UUID of first signal (reference). |
required |
uuid_b
|
str
|
UUID of second signal (lagged). |
required |
resample
|
str
|
Resample interval for alignment. |
'1min'
|
max_lag
|
int
|
Maximum lag periods to test (in both directions). |
30
|
Returns:
| Name | Type | Description |
|---|---|---|
DataFrame |
DataFrame
|
lag_periods, correlation, is_best_lag |