Skip to content

Measures

A measure turns a behavior result into one number per recording, subject, behavior and time window: how many bouts, how much total time, how long a bout runs, how long until the first one. They are what a comparison contrasts between groups, and what measures export writes to CSV.

Every value is exact. The artifact stores each bout as an interval, so a windowed question is answered by intersecting intervals rather than by binning, so there is no bin width to choose and no resolution to lose. Durations are stored in nanoseconds and shown in seconds.

Left unset, a comparison computes every measure the chosen behavior result can answer. A measure that does not move is as much a result as one that does.

A label with labels inside it counts only what they leave. Labels nest, and each bout counts under its innermost label. So when you name a cluster "moving" and one of its branches "fast", the row for "moving" counts only the moving that is not "fast", and it reads moving (other). The numbers are not added up for you: to get all of "moving", add "moving (other)" and "fast". In measures.csv and a comparison's stats.csv, label keeps the plain name (moving), so files still join on it, label_display holds the name shown (moving (other)), and label_is_remainder is True on those rows.

Time in unnamed clusters is measured on every clustering run: the time no label of yours covers yet, which is all of it before you name anything. A query run names every behavior, so it has none.

The measures

Measure Id Unit What it reports Needs
Bouts n_instances count How many separate bouts of the behavior occurred. —
Rate rate per second Bouts per second of observed time — not per second of window length. —
Total time total_time duration How much time the behavior occupies in total. —
Share of time time_fraction share of time What proportion of the observed time the behavior occupies. —
Mean bout length duration_mean duration How long a typical bout lasts. —
Median bout length duration_median duration The middle bout length, unmoved by a few very long or short bouts. —
Bout length spread duration_sd duration How variable the bout lengths are (population sd). —
Time to first bout latency_to_first duration How long from the start of the window until the behavior first occurs. —
Gap between bouts inter_bout_interval duration The mean pause between consecutive bouts — the gap, not the bout. —
Transitions transitions count How often this behavior is followed by another. exclusive
Time in unnamed clusters unnamed_time duration Observed time in real clusters that have not been named yet. unnamed_labels

The id is what --measure takes and what the measure column of stats.csv and measures.csv holds; the name is what every screen shows.

Transitions answers per ordered pair — one row for each behavior that follows each other behavior, with the from in the label column and the to in label_to. A vocabulary of twenty behaviors is up to four hundred of those, so they are reported as rows and not drawn as four hundred figures; the table and stats.csv carry them all.

What a measure needs

A measure that a behavior result cannot answer is greyed out where it is offered, with the reason attached, and produces no rows if you ask for it anyway — rather than a column of zeros that reads like a result.

Needs Withheld when
exclusive the behaviors can overlap, so 'what came next' has no answer
unnamed_labels every behavior in this run is named, so there is no unnamed time to measure

How a window is counted

Rule Which bouts it sees
onset counts a bout in the window that contains its start
overlap counts the part of each bout that falls inside the window
pair reads a bout together with its neighbour in the sequence, and counts it in the window where the first of the two starts

Movement and body shape

A comparison over a location-export run measures these instead, one value for each recording and animal. They are read from the run's per-frame tables, so they need a location export that measured the body and a distance calibration on every recording.

Measure Id Unit What it reports
Distance travelled distance m Length of the smoothed path of the body's centre, summed within unbroken stretches of tracking.
Time moving time_moving share of time Share of tracked time the body's centre moved faster than the moving threshold.
Speed when moving speed_moving cm/s Mean speed over the time counted as moving. No value for an animal that never moved.
Body length body_length mm Median length of the body along its long axis.
Body width body_width mm Median width of the body across its long axis.
Body length : width body_elongation ratio (no unit) Median of the body's length divided by its width, frame by frame: how stretched out or balled up the animal is. It does not depend on the calibration.
Body area body_area cm² Median area of the body.