ts_shape.events.engineering
¤
Engineering Events
Detectors for engineering-related patterns over shaped timeseries.
- SetpointChangeEvents: Detect setpoint changes and compute response KPIs.
- detect_setpoint_steps: Point events where |Δsetpoint| ≥ min_delta and holds for min_hold.
- detect_setpoint_ramps: Intervals where |dS/dt| ≥ min_rate for at least min_duration.
- detect_setpoint_changes: Unified table of steps and ramps with standardized columns.
- time_to_settle: Time until |actual − setpoint| ≤ tol for a hold duration within a window.
-
overshoot_metrics: Peak overshoot magnitude/percent and time-to-peak after a change.
-
StartupDetectionEvents: Detect startup intervals from thresholds or slope.
- detect_startup_by_threshold: Rising threshold crossing with minimum dwell above threshold.
- detect_startup_by_slope: Intervals with sustained positive slope ≥ min_slope for min_duration.
Modules:
Classes:
-
SetpointChangeEvents
–Detect step/ramp changes on a setpoint signal and compute follow-up KPIs
-
StartupDetectionEvents
–Detect equipment startup intervals based on threshold crossings or
SetpointChangeEvents
¤
SetpointChangeEvents(dataframe: DataFrame, setpoint_uuid: str, *, event_uuid: str = 'setpoint_change_event', value_column: str = 'value_double', time_column: str = 'systime')
Bases: Base
Detect step/ramp changes on a setpoint signal and compute follow-up KPIs like time-to-settle and overshoot based on an actual (process) value.
Schema assumptions (columns): - uuid, sequence_number, systime, plctime, is_delta - value_integer, value_string, value_double, value_bool, value_bytes
Methods:
-
detect_setpoint_changes
–Unified setpoint change table (steps + ramps) with standardized columns.
-
detect_setpoint_ramps
–Interval events where |dS/dt| >= min_rate for at least
min_duration
. -
detect_setpoint_steps
–Point events at times where the setpoint changes by >= min_delta and the
-
get_dataframe
–Returns the processed DataFrame.
-
overshoot_metrics
–For each change, compute peak overshoot relative to the new setpoint
-
time_to_settle
–For each setpoint change (any change), compute time until the actual signal
Source code in src/ts_shape/events/engineering/setpoint_events.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
|
detect_setpoint_changes
¤
detect_setpoint_changes(*, min_delta: float = 0.0, min_rate: Optional[float] = None, min_hold: str = '0s', min_duration: str = '0s') -> DataFrame
Unified setpoint change table (steps + ramps) with standardized columns.
Source code in src/ts_shape/events/engineering/setpoint_events.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
|
detect_setpoint_ramps
¤
Interval events where |dS/dt| >= min_rate for at least min_duration
.
Returns:
-
DataFrame
–DataFrame with columns: start, end, uuid, is_delta, change_type='ramp',
-
DataFrame
–avg_rate, delta.
Source code in src/ts_shape/events/engineering/setpoint_events.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
|
detect_setpoint_steps
¤
Point events at times where the setpoint changes by >= min_delta and the
new level holds for at least min_hold
(no subsequent change within that time).
Returns:
-
DataFrame
–DataFrame with columns: start, end (== start), uuid, is_delta,
-
DataFrame
–change_type='step', magnitude, prev_level, new_level.
Source code in src/ts_shape/events/engineering/setpoint_events.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|
get_dataframe
¤
get_dataframe() -> DataFrame
Returns the processed DataFrame.
Source code in src/ts_shape/utils/base.py
34 35 36 |
|
overshoot_metrics
¤
For each change, compute peak overshoot relative to the new setpoint within a lookahead window.
Returns:
-
DataFrame
–DataFrame with columns: start, uuid, is_delta, overshoot_abs,
-
DataFrame
–overshoot_pct, t_peak_seconds.
Source code in src/ts_shape/events/engineering/setpoint_events.py
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 |
|
time_to_settle
¤
time_to_settle(actual_uuid: str, *, tol: float, hold: str = '0s', lookahead: str = '10m') -> DataFrame
For each setpoint change (any change), compute time until the actual signal
is within ±tol
of the new setpoint for a continuous duration of hold
.
Returns:
-
DataFrame
–DataFrame with columns: start, uuid, is_delta, t_settle_seconds, settled.
Source code in src/ts_shape/events/engineering/setpoint_events.py
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
|
StartupDetectionEvents
¤
StartupDetectionEvents(dataframe: DataFrame, target_uuid: str, *, event_uuid: str = 'startup_event', value_column: str = 'value_double', time_column: str = 'systime')
Bases: Base
Detect equipment startup intervals based on threshold crossings or sustained positive slope in a numeric metric (speed, temperature, etc.).
Schema assumptions (columns): - uuid, sequence_number, systime, plctime, is_delta - value_integer, value_string, value_double, value_bool, value_bytes
Methods:
-
detect_startup_by_slope
–Startup intervals where per-second slope >=
min_slope
for at least -
detect_startup_by_threshold
–Startup begins at first crossing above
threshold
(or hysteresis enter) -
get_dataframe
–Returns the processed DataFrame.
Source code in src/ts_shape/events/engineering/startup_events.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
|
detect_startup_by_slope
¤
detect_startup_by_slope(*, min_slope: float, slope_window: str = '0s', min_duration: str = '0s') -> DataFrame
Startup intervals where per-second slope >= min_slope
for at least
min_duration
. slope_window
is accepted for API completeness but the
current implementation uses instantaneous slope between samples.
Returns:
-
DataFrame
–DataFrame with columns: start, end, uuid, is_delta, method, min_slope, avg_slope.
Source code in src/ts_shape/events/engineering/startup_events.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
|
detect_startup_by_threshold
¤
detect_startup_by_threshold(*, threshold: float, hysteresis: tuple[float, float] | None = None, min_above: str = '0s') -> DataFrame
Startup begins at first crossing above threshold
(or hysteresis enter)
and is valid only if the metric stays above the (exit) threshold for at
least min_above
.
Returns:
-
DataFrame
–DataFrame with columns: start, end, uuid, is_delta, method, threshold.
Source code in src/ts_shape/events/engineering/startup_events.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
|
get_dataframe
¤
get_dataframe() -> DataFrame
Returns the processed DataFrame.
Source code in src/ts_shape/utils/base.py
34 35 36 |
|