LabelConverter#
- class ethograph.labels.converters.LabelConverter[source]#
Bases:
objectBase class for converting external label sources to ethograph intervals.
Subclasses override
extract()to pull intervals from their source (NWB, pynapple, crowsetta, …). The sharedresolve_labels()method centralises the “TSV on disk → extract from source → empty” fallback chain used by everyLoadResult-producing function indata_loader.Methods
extract([trials_df])Return an all-labels DataFrame (with
trialcolumn).resolve_labels(source_path, trial_ids[, ...])Load labels with fallback: existing TSV → extract from source → empty.
- resolve_labels(source_path, trial_ids, trials_df=None, labels_path=None)[source]#
Load labels with fallback: existing TSV → extract from source → empty.
- Parameters:
source_path (
str|Path) – Primary data file; used to derive the default TSV path.trial_ids (
list) – Trial identifiers (for the empty-labels fallback).trials_df (
DataFrame|None) – Passed toextract()for global→trial conversion.labels_path (
Path|None) – Override the TSV path (e.g. for NWB project directories).
- Return type: