Skip to main content

ndx-ethogram Extension for NWB

An NWB extension for storing a curated, tool-agnostic ethogram as labeled behavioral bouts: one row per bout, where a bout is a continuous interval of a single behavior. EthogramBouts is a TimeIntervals subclass, so each row inherits start_time and stop_time and adds a single text label.

It is the downstream-oriented, lossy-by-design product of behavioral segmentation and classification tools. Named producers (DeepEthogram, SimBA, CalMS21, CRIM13) give the label a human-readable behavior name; integer-only unsupervised producers (VAME, keypoint-MoSeq, B-SOiD) give it the tool's own cluster id as text (e.g. "7"). Overlapping behaviors are simply overlapping rows. A tool's faithful native output (per-frame motif or syllable stream) lives in its own extension and is referenced through the generic source link, so this extension depends on no tool-specific extension.

Installation

pip install ndx-ethogram

Or from a clone of this repository:

pip install -e .

Usage

from datetime import datetime, timezone

from pynwb import NWBFile, NWBHDF5IO
from ndx_ethogram import EthogramBouts

nwbfile = NWBFile(
    session_description="social behavior session",
    identifier="session-001",
    session_start_time=datetime(2024, 1, 1, tzinfo=timezone.utc),
)

# One EthogramBouts table. `labeling_method` is required: "manual" (a human scored
# the video), "automated" (an algorithm), or "curated" (human-reviewed model output).
bouts = EthogramBouts(
    name="behavior_bouts",
    description="DeepEthogram behavior bouts",
    labeling_method="manual",
    source_software="DeepEthogram 0.1.4",   # optional
    annotator="lab annotator 1",            # optional
)

# One row per bout. `label` is the only added column (single required text column).
bouts.add_row(start_time=1.0, stop_time=2.5, label="grooming")
bouts.add_row(start_time=2.0, stop_time=3.0, label="rearing")   # overlap is allowed

behavior = nwbfile.create_processing_module("behavior", "behavioral bouts")
behavior.add(bouts)

with NWBHDF5IO("example.nwb", "w") as io:
    io.write(nwbfile)

A EthogramBouts table can point at the objects it was derived from or aligns to, each optional:

  • source_pose -> the upstream ndx-pose PoseEstimation (pose-based tools).
  • source_video -> the behavioral video ImageSeries the bouts align to.
  • source -> the producing faithful object (e.g. a per-frame motif/syllable TimeSeries or a tool-specific container); a generic NWBDataInterface target so this extension stays tool-agnostic.
  • observation_intervals -> a core TimeIntervals marking the spans over which the labels were assessed, for partial-coverage inputs. Within them, absence of a bout means the behavior was absent; outside, it was unobserved. Omit when assessed throughout.
bouts.source_pose = pose_estimation     # an ndx_pose.PoseEstimation
bouts.source_video = behavior_video     # a pynwb.image.ImageSeries

Attributes and columns at a glance

Field Kind Required Meaning
start_time, stop_time column (float, s) yes (inherited) the bout span
label column (text) yes the bout's behavior / motif / cluster identity
labeling_method attribute yes manual, automated, or curated
source_software attribute no producing tool and version
annotator attribute no human or lab who produced manual/curated labels
parameters attribute no JSON-encoded key hyperparameters
source link no the faithful producing object
source_pose link no upstream PoseEstimation
source_video link no the behavioral video ImageSeries
observation_intervals link no spans over which labels were assessed

Only durative (state) behaviors belong here; instantaneous point behaviors belong in an EventsTable.


This extension was created using ndx-template.

Metadata

Release files for ndx-ethogram 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ndx-ethogram 0.1.0
File Size Uploaded Provenance
ndx_ethogram-0.1.0.tar.gz 185.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ndx-ethogram 0.1.0
File Interpreter ABI Platform
ndx_ethogram-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 193.8 kB

Release files / ndx_ethogram-0.1.0.tar.gz

Download URL ndx_ethogram-0.1.0.tar.gz
Size 185.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c31ae967cc0d2f243b2547de1f86b85551ae4daeaf6eb19e415dc1a01d4a3be8
BLAKE2b-256 checksum
How to use checksums
5a66ff792a13a929fbb6576c9740aa52a6ef8543c6617c732b3edf9f178ecd65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 24, 2026.

Transparency log

Release files / ndx_ethogram-0.1.0-py3-none-any.whl

Download URL ndx_ethogram-0.1.0-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a2cbf9110241347208489fa2b75e08f46bd34a98a834d05e937e94aa3a088bd2
BLAKE2b-256 checksum
How to use checksums
29d64d990aa702bd6763993c9aec867db04e3bb66faf39926f744dbe4d680588
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 24, 2026.

Transparency log

Security for ndx-ethogram 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ndx_ethogram-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page