ethograph.labels.tsv_store#

TSV-based label storage for EthoGraph.

File format:

trial - trial identifier individual - individual identifier labels - integer label class ID onset_s - start time in seconds (trial-relative) offset_s - end time in seconds (trial-relative) n_samples - per-trial sample count for dense conversion (int, 0 if unknown) human_verified - per-trial flag (0/1), repeated per row changepoint_corrected - per-trial flag (0/1), repeated per row prediction_source - path to prediction file that produced this label (empty if human)

Label names are managed centrally in mapping.txt.

Functions

labels_tsv_path

Derive the labels TSV path from the .nc file path.

validate_labels_tsv

Validate that a labels DataFrame has all required columns.

load_labels_tsv

Load labels from a TSV file.

save_labels_tsv

Save labels DataFrame to TSV.

get_trial_from_tsv

Extract all rows for a single trial from the all-labels DataFrame.

set_trial_in_tsv

Replace all rows for a trial in the all-labels DataFrame.

get_trial_meta

Read per-trial metadata from columns.

set_trial_meta_attr

Set a per-trial metadata column value for all rows of a trial.

init_empty_labels

Create empty labels DataFrame.

Constants

ethograph.labels.tsv_store.REQUIRED_COLUMNS = {'individual', 'labels', 'offset_s', 'onset_s', 'trial'}#

set() -> new empty set object set(iterable) -> new set object

Build an unordered collection of unique elements.

ethograph.labels.tsv_store.TSV_COLUMNS = ['trial', 'individual', 'labels', 'onset_s', 'offset_s', 'event_type', 'human_verified', 'changepoint_corrected', 'prediction_source', 'n_samples']#

Built-in mutable sequence.

If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.

ethograph.labels.tsv_store.TRIAL_META_COLUMNS = ['human_verified', 'changepoint_corrected', 'prediction_source', 'n_samples']#

Built-in mutable sequence.

If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.

ethograph.labels.tsv_store.TRIAL_META_DEFAULTS = {'changepoint_corrected': 0, 'human_verified': 0, 'n_samples': 0, 'prediction_source': ''}#

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)