correct_offsets_trial#

ethograph.labels.export.correct_offsets_trial(df)[source]#

Apply gap correction to a single trial’s interval DataFrame.

For each individual, pulls back offset_s when the gap to the next onset is smaller than eps so pynapple can resolve all intervals.

Works on the per-trial format (columns: trial, onset_s, offset_s, labels, individual) returned by app_state.get_trial_intervals().

Returns:

Corrected DataFrame, number of offsets corrected, number of negative gaps found.

Return type:

tuple[pd.DataFrame, int, int]