PynappleLabelConverter#

class ethograph.labels.converters.PynappleLabelConverter(data, trials_ep=None)[source]#

Bases: LabelConverter

Extract labels from pynapple IntervalSet objects.

Collects every nap.IntervalSet in the data dict except the one detect_trials() reads as trial boundaries. Each IntervalSet name becomes a label class.

Methods

extract([trials_df])

Return an all-labels DataFrame (with trial column).

resolve_labels(source_path, trial_ids[, ...])

Load labels with fallback: existing TSV → extract from source → empty.

extract(trials_df=None)[source]#

Return an all-labels DataFrame (with trial column).

Parameters:

trials_df (pd.DataFrame | None) – Must contain trial, start_time, stop_time columns. Required for sources with global timestamps (NWB, pynapple).

Return type:

pd.DataFrame