Zarr Serving Copy
NEMAR tracks every recording in an index and, where conversion succeeds, maintains a derived Zarr version 3 (v3) copy in a published Brain Imaging Data Structure (BIDS) dataset. This lets a browser scrub a signal without downloading the whole file and lets a machine learning (ML) pipeline stream samples instead of pulling the original recording first.
This section is the contract for anyone building against that copy:
a viewer, an inference service, a training loader, or an agent.
It does not cover how the copy is produced or operated;
that is a separate, access-gated runbook for NEMAR administrators (/admin/operations/zarr-serving/).
- Store contract — the Zarr v3 layout inside one recording’s store:
groups, the level-0 signal array, the
view/*render pyramid, theeventsgroup, and how to turn stored integers back into physical units. - Index contract — the per-dataset
index.jsondocument that lists every store, failure, and pending recording, field by field, plus the sidecarmanifest.json, the dataset-wideevents.parquetfile, and the top-level discovery catalog. - Access and hosting — which URL is stable, how anonymous reads work, the browser-versus-machine split at the edge, caching, and rate limits.
- Cost ladder and recipes for agents — roughly how many bytes and requests each layer of the contract costs, and worked read recipes in Python and JavaScript.
- Format stability policy — what
format_versionpromises, what counts as additive versus breaking, and where a client should watch for change.
What this copy is, and is not
Section titled “What this copy is, and is not”- Derived and reproducible. Every store is generated from the dataset’s BIDS recordings; BIDS remains the source of truth, and a store can always be rebuilt from it.
- Latest-only, not versioned. The copy tracks the dataset repository’s
mainbranch head. There is one store per recording, not one per released dataset version, and there is no history: a re-conversion overwrites the previous store in place. For a specific, citable version of a dataset, use its archived release and Digital Object Identifier (DOI), not this copy. - Not citable data. The copy is a viewing and streaming convenience, not an archival format, and is not a substitute for the dataset’s own archived, versioned, DOI-assigned data.
- Raw recordings only. Coverage is BIDS raw data, the recordings under each subject or session data-type folder. Derivatives, source data, and code folders are out of scope and are never converted (Architecture Decision Record (ADR) 0027).
- No subject information. A store holds the data, the events, channel names, types and units, and technical recording metadata, and never the subject: age, sex, patient code, birth date and name stay at dataset scope, in
participants.tsv, and operator text is not written at all. The converter leaves them out of every store it writes and marks the storesubject_info_excluded: true; a store converted before that rule can still hold some until it is rewritten or reconverted. See Store contract: what a store does not contain. - Almost always the source signal, with one disclosed exception. A store normally carries the recording as acquired, quantized and rate-capped, and nothing else.
Some magnetoencephalography (MEG) recordings are acquired with internal active shielding, which distorts the signal until corrected;
those recordings are corrected before serving and the resulting store is a processed derivative rather than the raw signal (ADR 0028).
See Store contract:
derivedandsssbefore training across datasets. - No stability promise beyond what is written here. Every index and every store carries explicit
formatandformat_versionfields. Treat this section as a description of the current contract, and check those fields in code that needs to detect a future change; see Format stability policy.
An alternative to the data file, not to the dataset
Section titled “An alternative to the data file, not to the dataset”A store is a frequency-capped, minimally lossy alternative to one recording’s data file
(see Lossy on purpose for exactly what it gives up).
It stands in for that data file,
together with any companion files the format splits it into (an EEGLAB .fdt, a BrainVision .eeg and .vmrk).
It does not stand in for the dataset.
Everything else in the BIDS dataset stays where it is and stays authoritative:
dataset_description.json, participants.tsv, the sessions and scans tables,
and each recording’s sidecars (*_eeg.json, channels.tsv, electrodes.tsv, events.tsv).
The intended workflow is to clone the dataset, then swap data files for stores:
-
Clone the dataset without its data files:
Terminal window nemar dataset download nm000103 --no-dataThis gives the full BIDS tree with every sidecar, and pointers in place of the large data files.
-
For each recording you need, read its store at the same relative path, with the data file’s extension replaced by
.zarr:sub-01/eeg/sub-01_task-rest_eeg.edfis served athttps://zarr.nemar.org/nm000103/zarr/sub-01/eeg/sub-01_task-rest_eeg.zarr/. The dataset’sindex.jsonsays which recordings have a store; a recording without one is still read from its data file. -
Check that each store was built from the tree you cloned: its
nemar.source_commitattribute should equal the clone’s commit (git rev-parse HEAD). The copy tracks the dataset’s latest state, so a store built from a different commit can disagree with the sidecars next to it.
The result is a working copy for analysis, not a BIDS dataset to validate or upload. No CLI command does step 2 for you yet; any Zarr v3 reader works, as in the recipes.
Lossy on purpose, and as faithful as it can be
Section titled “Lossy on purpose, and as faithful as it can be”A store is not a bit-for-bit copy of the recording, and it does not pretend to be. It loses two things, both deliberately:
- Content above the rate cap. Each modality has a ceiling (250 Hz for EEG and MEG, 1000 Hz for iEEG and EMG; see the rate caps), so a 250 Hz store keeps the signal up to near 125 Hz. That covers every standard scalp EEG band, high gamma included as it is usually analyzed in scalp recordings, and the great majority of analyses work well below those frequencies; the caps were chosen for that reason.
- Precision finer than a 16-bit step. Samples are stored as 16-bit integers with a scale and offset of their own for each channel.
Within those two limits, the conversion aims to be the most faithful representation possible at the capped rate:
- Downsampling is anti-aliased: a windowed low-pass filter runs before decimation, so energy above the new Nyquist frequency is removed rather than folded back into the band you analyze, and the filter is zero-phase, so events and features do not shift in time.
- A recording already at or below its cap keeps its native rate; nothing is resampled upward.
- Each channel’s 16 bits span that channel’s own range, so the rounding error is at most half a step, one part in about 131,000 of the channel’s range. A channel with a very large artifact therefore gets a coarser step than a clean one.
- Trigger and clock channels are resampled by nearest sample, with no filter, so their step edges survive.
- Every store records what was done:
source_rate_hz,anti_aliased, and the per-channelscaleandoffset.
If your analysis needs frequencies above the cap, such as scalp EEG activity above 125 Hz or iEEG high-frequency oscillations above 500 Hz, or the exact recorded values, read the BIDS data file instead.
Why this layout, and not NWB or OME-Zarr
Section titled “Why this layout, and not NWB or OME-Zarr”Two community formats already put scientific data in Zarr:
Neurodata Without Borders (NWB), through its Zarr backend hdmf-zarr,
and OME-Zarr, the Open Microscopy Environment’s format for bioimaging.
NEMAR uses its own small layout instead, for three reasons.
- They have a different scope.
An NWB file is meant to be the complete, archival record of a session,
with its session and subject context (a start time, electrode groups, devices, locations) alongside the data.
OME-Zarr is built around multidimensional images rather than multichannel recordings with events.
A NEMAR store is narrower than both: one recording’s signal, normalized for analysis and viewing,
while the BIDS dataset stays the record.
Making every store a valid NWB file would copy metadata the dataset already holds,
and a second copy of metadata drifts from the first as the dataset is revised.
A store carries only what a reader needs to decode the signal
(channel labels, types and units, scale and offset, the served rate, events and electrode positions),
all generated from the BIDS files at
source_commitand never edited afterward. - The layouts are technically incompatible. NWB stores time-first arrays with one conversion factor per series; a store is channels-first, with a scale and offset for each channel and a min/max pyramid for viewing. NWB also requires typed objects linked by references, a cached copy of its schema, and compound data types that rely on Zarr extension types, and its default consolidated metadata goes stale when a store is rewritten in place, as NEMAR’s stores are on re-conversion.
- The NWB Zarr specification is not settled yet. As of November 2026, its maintainers describe the Zarr backend as under development and subject to change, its most recent release changed the on-disk format in a way older readers cannot open, and validation of Zarr files in the NWB tools is still incomplete. Building a public contract on it now would tie NEMAR’s stability promise to a format that is still moving.
Two ideas line up with NWB on purpose, so a conversion stays straightforward.
The per-channel physical = digital * scale + offset is NWB’s conversion and offset, given per channel instead of per series.
Event columns follow BIDS and Hierarchical Event Descriptors (HED), which the ndx-hed extension maps onto NWB’s events table.
If you need NWB, convert from the BIDS data files, which are the archival copy, rather than from the serving copy. If a workflow of yours needs NWB output from NEMAR, open an issue: an export generated on request is the path NEMAR would take, not a second stored copy.
Current rollout status
Section titled “Current rollout status”The producer and serving contract described here is deployed in production. Checked on
2026-09-09: nm000103 served an index with format_version: 3, a manifest.json, and
events.parquet; https://zarr.nemar.org/catalog.json returned a catalog with 625 datasets;
and api.nemar.org returned working has_zarr and has_zarr_verified filters.
The staging schema endpoints are live, but zarr-test.nemar.org/catalog.json currently reports
zero datasets. Do not infer staging dataset availability from the contract alone. Older datasets
can retain an earlier producer shape until they are reconverted, so clients should read each
index’s format_version, engine_version, biosigio_version, and timestamps rather than
assuming the platform has one conversion state.
| Capability | Current production status (checked 2026-09-09) |
|---|---|
| Index format | v3 on sampled nm000103; older datasets may coexist |
nemar root attribute and geometry |
present on a sampled current store written by biosigIO 1.2.7 |
| Schemas | live at api.nemar.org/schemas/zarr-index-v3.json and zarr-manifest-v1.json |
| Catalog | live at zarr.nemar.org/catalog.json (625 entries at the check) |
| Manifest and events | live for nm000103; optional fields or files can be absent for other datasets |
| Non-browser store/document GET | 302 to public S3; browser-origin GETs are proxied; HEAD remains proxied |
| API filters | live; sample totals were 625 for has_zarr and 51 for has_zarr_verified |
Anonymous object reads and s3:ListBucket denial |
object reads are public; bucket listing remains denied |
events.parquet was introduced in the nemar-cli 0.9.12 line through
nemarOrg/nemar-cli#1205 and is now live for
datasets whose current conversion produced it. The release and issue references describe the
history of the rollout; they are not a promise that every dataset has already been reconverted.