correct_changepoints_dense#

ethograph.features.changepoints.correct_changepoints_dense(labels, ds, all_params)[source]#

Correct dense label arrays using changepoints (legacy ML pipeline).

Operates on integer label arrays, not interval DataFrames. Use correct_changepoints() for the modern interval-native pipeline.

Parameters:
  • labels (array-like) – Dense integer label array of shape (T,).

  • ds (xr.Dataset) – Trial dataset containing changepoint variables.

  • all_params (dict) –

    Keys:

    • cp_kwargs: Selection kwargs forwarded to ds.sel().

    • min_label_length_s: Minimum label duration in seconds.

    • stitch_gap_len_s: Maximum gap to stitch in seconds.

    • label_thresholds_s: Per-label minimum durations (dict).

    • changepoint_params: Dict with max_expansion_s and max_shrink_s.

    • fps: Frame rate used to convert seconds to sample counts.

Returns:

Corrected integer label array of the same shape as labels.

Return type:

np.ndarray