PyNWB is the official Python API for working with Neurodata Without Borders (NWB) files, a standardized data format for neurophysiology data. It facilitates reading, writing, and manipulating NWB files, providing a high-level interface to the underlying HDF5 structure. The current version is 3.1.3, and it maintains an active release cadence with regular minor updates and less frequent major versions supporting new NWB schema versions.
pip install pynwbVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to create a basic NWB file, add a TimeSeries to it, and then write and read the file from disk using `NWBFile` and `NWBHDF5IO`. It covers the fundamental steps for data archival in the NWB format.
If you rely on the pre-3.0.0 behavior of `pynwb.validate(io=...)` without cached namespaces, update your call to `pynwb.validate(io=..., use_cached_namespaces=False)` to explicitly disable caching for that operation.
These were internal functions. If your code was inadvertently using them, you will need to refactor to use documented public APIs or directly interact with the NWB schema as needed.
Always ensure your NWB file paths end with the `.nwb` extension (e.g., `myfile.nwb`) to adhere to NWB best practices and avoid warnings.
Upgrade to pynwb version 3.1.2 or later to benefit from the performance fix for large NWB files.
Import `NWBHDF5IO` directly from the top-level `pynwb` package: `from pynwb import NWBHDF5IO`.
Ensure `session_start_time` (a `datetime` object) and `identifier` (a unique string) are always provided during `NWBFile` initialization. Example: `NWBFile(session_description='...', identifier='my_session', session_start_time=datetime.now().astimezone())`.
Verify the exact name of the object you are trying to access. Use `nwbfile.acquisition.keys()` to list available acquisition objects, or consult the NWB file's structure or the code that generated it.