enrich_labels_df#

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

Add the computed analysis columns to a raw labels table.

Adds duration, sequence, sequence_idx, the trial’s timing on the session clock (trial_onset, trial_offset, onset_global, offset_global) and every trial metadata column.

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

  • nwb_alignment – Session alignment, for trial timing. Without one, or with one whose times are no session clock (alignment.session_clock), the global columns are left out.

  • dt (TrialTree, optional) – Handed to exporter; unused otherwise.

  • metadata_df (pd.DataFrame, optional) – Trial metadata table, joined per trial.

  • exporter (callable, optional) – The lab’s own columns (labels/exporters/). Without one, only the columns above are added.

  • session_dir (Path, optional) – Handed to exporter, for a sidecar file beside the session.

Returns:

One row per non-background segment. Empty when there is nothing to export.

Return type:

pd.DataFrame