micro_stop_detection
micro_stop_detection ¤
MicroStopEvents ¤
MicroStopEvents(
dataframe: DataFrame,
run_state_uuid: str,
*,
event_uuid: str = "prod:micro_stop",
value_column: str = "value_bool",
time_column: str = "systime"
)
Bases: Base
Production: Micro-Stop Detection
Detect brief idle intervals that individually seem harmless but accumulate into significant availability losses.
Methods: - detect_micro_stops: Find idle intervals shorter than max_duration. - micro_stop_frequency: Count micro-stops per time window. - micro_stop_impact: Time lost to micro-stops per window. - micro_stop_patterns: Group micro-stops by hour-of-day.
detect_micro_stops ¤
detect_micro_stops(
max_duration: str = "30s", min_duration: str = "0s"
) -> pd.DataFrame
Find idle intervals shorter than max_duration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_duration
|
str
|
Maximum duration to qualify as a micro-stop. |
'30s'
|
min_duration
|
str
|
Minimum duration to include (filter very short glitches). |
'0s'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns: start_time, end_time, duration, |
DataFrame
|
preceding_run_duration. |
micro_stop_frequency ¤
micro_stop_frequency(
window: str = "1h", max_duration: str = "30s"
) -> pd.DataFrame
Count micro-stops per time window.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
window
|
str
|
Resample window. |
'1h'
|
max_duration
|
str
|
Maximum idle duration to qualify as micro-stop. |
'30s'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns: window_start, count, total_lost_time, |
DataFrame
|
pct_of_window. |
micro_stop_impact ¤
micro_stop_impact(
window: str = "1h", max_duration: str = "30s"
) -> pd.DataFrame
Time lost to micro-stops vs total available time per window.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
window
|
str
|
Resample window. |
'1h'
|
max_duration
|
str
|
Maximum idle duration to qualify as micro-stop. |
'30s'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns: window_start, total_run_time, |
DataFrame
|
total_micro_stop_time, availability_loss_pct. |
micro_stop_patterns ¤
micro_stop_patterns(
hour_grouping: bool = True, max_duration: str = "30s"
) -> pd.DataFrame
Group micro-stops by hour-of-day to find clustering patterns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hour_grouping
|
bool
|
If True, group by hour. If False, group by shift (8h blocks). |
True
|
max_duration
|
str
|
Maximum idle duration to qualify as micro-stop. |
'30s'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns: hour (or shift), avg_count, avg_lost_time. |