ts_shape.events.engineering.rate_of_change
Classes
| Name | Description |
|---|---|
RateOfChangeEvents | Engineering: Rate of Change Events |
RateOfChangeEvents
RateOfChangeEvents(
dataframe: pd.DataFrame,
signal_uuid: str,
*,
event_uuid: str = "eng:rate_of_change",
value_column: str = "value_double",
time_column: str = "systime"
) -> None
Bases: Base
Engineering: Rate of Change Events
Detect rapid changes and step jumps in a numeric signal.
Methods:
- detect_rapid_change: Flag intervals where rate of change exceeds threshold.
- rate_statistics: Per-window rate of change statistics.
- detect_step_changes: Sudden value jumps within a short duration.
Functions
| Name | Description |
|---|---|
detect_rapid_change | Flag intervals where rate of change exceeds threshold. |
rate_statistics | Per-window statistics of the absolute rate of change. |
detect_step_changes | Detect sudden value jumps within a short duration. |
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
dataframe | DataFrame | Long-format timeseries frame (one row per sample, uuid identifies the signal). | required |
signal_uuid | str | UUID of the signal to analyze. | required |
event_uuid | str | UUID stamped on emitted events. | 'eng:rate_of_change' |
value_column | str | Column holding the signal values. | 'value_double' |
time_column | str | Timestamp column. | 'systime' |
detect_rapid_change
detect_rapid_change(
threshold: float, window: str | None = None
) -> pd.DataFrame
Flag intervals where rate of change exceeds threshold.
Each run of consecutive samples whose absolute rate is at or above
threshold becomes one interval. The rate at a sample describes the
step from the previous sample to it, so an interval starts at the
sample before the first fast step and ends at the last sample of
the run: a single fast step from t[i-1] to t[i] lasts
t[i] - t[i-1], not zero.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
threshold | float | Minimum absolute rate (units/second) to flag. | required |
window | str | None | Deprecated and not used: the rate is always computed between consecutive samples. Passing any value emits a DeprecationWarning. Filter the result on duration_seconds to drop short intervals. | None |
Returns
| Type | Description |
|---|---|
DataFrame | DataFrame with columns: start, end, duration_seconds, uuid, |
DataFrame | source_uuid, max_rate, direction. |
rate_statistics
rate_statistics(window: str = '1h') -> pd.DataFrame
Per-window statistics of the absolute rate of change.
The statistics are over |rate| (signal units per second between
consecutive samples), so a falling signal gives positive values.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
window | str | Resample window. | '1h' |
Returns
| Type | Description |
|---|---|
DataFrame | DataFrame with columns: start, end, duration_seconds, mean_rate, |
DataFrame | mean_abs_rate, std_rate, std_abs_rate, max_rate, max_abs_rate, |
DataFrame | min_rate, min_abs_rate. end is start + window. |
DataFrame | Canonical twin columns: mean_abs_rate, std_abs_rate, |
DataFrame | max_abs_rate and min_abs_rate, each right after the |
DataFrame | column of the same values. The *_rate columns hold absolute |
DataFrame | values today; in the next major release they become statistics |
DataFrame | of the signed rate, so read the *_abs_rate columns for the |
DataFrame | absolute rate. |
detect_step_changes
detect_step_changes(min_delta: float, max_duration: str = '5s') -> pd.DataFrame
Detect sudden value jumps within a short duration.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
min_delta | float | Minimum absolute value change to qualify. | required |
max_duration | str | Maximum time window for the step to occur. | '5s' |
Returns
| Type | Description |
|---|---|
DataFrame | DataFrame with columns: systime, uuid, source_uuid, time, start, |
DataFrame | end, value_before, value_after, delta, duration, |
DataFrame | duration_seconds. systime and end equal time (the |
DataFrame | instant after the jump; time is a deprecated twin), start |
DataFrame | is the sample before the jump, and duration_seconds is the |
DataFrame | float-seconds twin of the Timedelta duration. |