Skip to main content

ezmsg-nwb

NWB (Neurodata Without Borders) file reading and writing for the ezmsg framework.

Overview

ezmsg-nwb provides streaming NWB file I/O as ezmsg Units.

Key features:

  • NWB Reader - Stream data from NWB files (local or remote) as AxisArray messages
  • NWB Writer - Write incoming AxisArray streams to NWB files with automatic container management
  • Flexible clock handling - Support for system, monotonic, and unknown reference clocks
  • Pipeline settings logging - Automatically record every component's settings into a pipeline_settings intervals table inside the NWB file

Installation

Install from PyPI:

pip install ezmsg-nwb

Or install the latest development version:

pip install git+https://github.com/ezmsg-org/ezmsg-nwb@main

Dependencies

  • ezmsg
  • ezmsg-baseproc
  • numpy
  • pynwb
  • h5py
  • neuroconv
  • remfile
  • pyyaml

Usage

See the examples folder for usage examples.

import ezmsg.core as ez
from ezmsg.nwb import NWBIteratorUnit, NWBSink

For general ezmsg tutorials and guides, visit ezmsg.org.

Pipeline settings table

When NWBSink is used inside an ez.run pipeline (with ezmsg>=3.9.0), it opens a GraphContext against the running graph server, snapshots the settings of every component in its session, and subscribes to subsequent settings change events. Each snapshot is flattened into dotted column names (e.g. MY.UNIT.MyUnitSettings.endpoint.host) and appended as a row to a pipeline_settings TimeIntervals table inside the NWB file, alongside an updated_component column identifying which component triggered the transition. Reading back is straightforward:

from pynwb import NWBHDF5IO

with NWBHDF5IO(path, "r") as io:
    nwbfile = io.read()
    df = nwbfile.intervals["pipeline_settings"].to_dataframe()

Notes:

  • Settings logging is best-effort. If the writer cannot connect to the graph server (e.g. when running the consumer outside of ez.run), it logs a warning and continues writing data without the table.
  • Settings values are sanitized for NWB storage: primitives, NumPy scalars, enums, paths, and fixed-shape sequences/arrays are stored natively; mappings and irregular structures are JSON-encoded; None becomes the string "None".
  • If a settings update changes a column's shape (scalar↔array or rank change), the writer rotates into a new file segment (<name>_01.nwb, <name>_02.nwb, …) so each segment's table stays internally consistent.

Development

We use uv for development.

  1. Install uv if not already installed.
  2. Fork this repository and clone your fork locally.
  3. Open a terminal and cd to the cloned folder.
  4. Run uv sync to create a .venv and install dependencies.
  5. (Optional) Install pre-commit hooks: uv run pre-commit install
  6. After making changes, run the test suite: uv run pytest tests

License

MIT License - see LICENSE for details.

Acknowledgements

This project is supported by the Wyss Center for Bio and Neuroengineering and by Blackrock Neurotech.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ezmsg_nwb-1.5.0.tar.gz (81.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ezmsg_nwb-1.5.0-py3-none-any.whl (44.7 kB view details)

Uploaded Python 3

File details

Details for the file ezmsg_nwb-1.5.0.tar.gz.

File metadata

  • Download URL: ezmsg_nwb-1.5.0.tar.gz
  • Upload date:
  • Size: 81.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ezmsg_nwb-1.5.0.tar.gz
Algorithm Hash digest
SHA256 90cfa02d2170625279cd63c5abefcf4cca1425aa5aa912eba6020a54a75be6f7
MD5 4ae6913176b8ae60e29a46d1986330d9
BLAKE2b-256 8bd26718e236083907d8d2041fabe89321a189b3cfc3bd350eb958545ff0517c

See more details on using hashes here.

File details

Details for the file ezmsg_nwb-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: ezmsg_nwb-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 44.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ezmsg_nwb-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b1fb6f21c96a656a95f48f5b7d71f0dc6ff555a899f5ce82414439bd31ebfca5
MD5 297c4641d798c99e065ca0c1568715c9
BLAKE2b-256 3feef9018086fa37da360b736c36c1136f4b0eda066e9dba191326ddb15b4a2a

See more details on using hashes here.

Release history Release notifications | RSS feed

1.8.1

2 files

1.8.0

2 files

1.7.0

2 files

1.6.0

2 files

This release

1.5.0 This release

2 files

1.4.2

2 files

1.4.1

2 files

1.4.0

2 files

1.3.1

2 files

1.3.0

2 files

1.2.0

2 files

1.1.0

2 files

1.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page