jnwb¶
Version 0.2.17
Dataset-agnostic Python library for Neurodata Without Borders (NWB 2.0+) electrophysiology: addressing, spikes, LFP, spectral analysis, statistics, population methods, decoding, connectivity, laminar CSD, filtering, QC, and visualization.
Condition codes, task structure, and experimental hypotheses belong in project code. The library operates on NWB files, numeric arrays, and metadata tables.
New to NWB in jnwb? Start with the Tutorials:
inspect → events / event_onsets → align spikes/LFP → compose an analysis.
Install¶
pip install -U jnwb
pip install "jnwb[torch,gpu]" # optional CuPy / PyTorch
Requires Python 3.12 or newer; CI tests 3.12 and 3.15 on Linux. See Installation.
Example¶
Welch PSD and canonical-band power on a synthetic oscillation:
import jnwb
import numpy as np
rng = np.random.default_rng(0)
fs = 1000.0
time = np.arange(1000) / fs
signal = np.sin(2 * np.pi * 20.0 * time) + 0.5 * rng.normal(size=1000)
freqs, psd = jnwb.compute_psd(signal, fs=fs)
beta_power = jnwb.band_power(
signal, fs=fs, freq_range=(14.0, 30.0), normalize=False,
)
print(f"Beta band power: {beta_power:.4f}")
Guides¶
- Installation: setup and verification
- Quickstart: runnable tour of core operations
- Reading NWB data: NWB reads, data roots and array slices
- Addressing & metadata
- Analyzing with an agent: what ships, the MCP server, and the skills
- Architecture: the two entry paths, scope, invariants and the module map
- Common mistakes: the failure modes jnwb guards against
- Errors: what each refusal means and what to pass instead
- Public API: every symbol in
jnwb.__all__ - References: published sources for each method
Figures¶
Synthetic, deterministic examples generated by scripts/figures/generate_figures.py from public APIs:











