enrich_labels_df#

ethograph.labels.export.enrich_labels_df(all_labels_df, nwb_alignment=None, keep_attrs=None, dt=None)[source]#

Enrich a raw labels DataFrame with computed columns for analysis export.

Takes the in-memory _all_labels_df (with columns onset_s, offset_s, labels, individual, trial) and adds session timing, duration, sequence info, and trial attributes.

Parameters:
  • all_labels_df (pd.DataFrame) – Raw labels with required columns: onset_s, offset_s, labels, individual, trial.

  • nwb_alignment – Session metadata (for trial timing).

  • keep_attrs (list[str], optional) – Trial-level ds.attrs keys to include as extra columns (xarray only).

  • dt (TrialTree, optional) – Xarray data tree (only needed for keep_attrs and session name).

Returns:

Enriched DataFrame with one row per non-background segment.

Return type:

pd.DataFrame