stitch_intervals#
- ethograph.labels.intervals.stitch_intervals(df, max_gap_s, individual=None)[source]#
Merge adjacent same-label intervals where gap <= max_gap_s.
- Parameters:
- Returns:
Stitched intervals DataFrame.
- Return type:
pd.DataFrame
Examples
>>> df = add_interval(empty_intervals(), 0.0, 1.0, 1, "A") >>> df = add_interval(df, 1.05, 2.0, 1, "A") >>> stitched = stitch_intervals(df, max_gap_s=0.1) >>> len(stitched) 1 >>> float(stitched.iloc[0]["offset_s"]) 2.0