Skip to content

RFC 0001: biosig-zarr, with .bzx as its single-file form - #2

Draft
neuromechanist wants to merge 11 commits into
mainfrom
rfc/0001-biosig-zarr
Draft

neuromechanist wants to merge 11 commits into
mainfrom
rfc/0001-biosig-zarr

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

RFC 0001: biosig-zarr, a Zarr format for biosignal recordings, with .bzx as its single-file form

The Neuroelectromagnetic Data Archive and Tools Resource (NEMAR) already serves 231,259 biosig-zarr stores (98.4% of the 235,038 recordings in its 910 public datasets, about 116,285 hours, measured 2026-11-20), read by its data viewer and by its Model Context Protocol (MCP) server for agentic research. At least 978 of those stores were converted from a source with a measured gap. This Request for Comments (RFC) asks the whole biosignal community, from electroencephalography (EEG), magnetoencephalography (MEG), intracranial EEG (iEEG), electromyography (EMG) and electrocardiography (ECG) to physiology, motion and wearables, and the people who build Zarr tools, to comment on the format and its single-file form, .bzx (a ZIP archive using the ZIP64 extension), before it is frozen. It proposes format_version 3, which keeps the timing of recordings with gaps, jittered streams and sparse signals explicit, in a form that no reader can silently misread: classic European Data Format (EDF) assumes contiguous records, and while its discontinuous variant EDF+D can encode irregular samples as individually timestamped records of duration 0, version 2 of this format has nowhere to keep that timing. Version 3 also records the source recording's resolution and every lossy step beside the stored samples. The proposed text is the comparison 2.0.2...3.0.0-draft.3 in nemarOrg/biosig-zarr; it becomes 3.0.0 only if the RFC is accepted. The package rules are compared with OME-Zarr RFC-9 (the Open Microscopy Environment's proposal for zipped OME-Zarr), which is prior art, not a dependency. Abbreviations used in the questions: the General Data Format for biomedical signals (GDF), the Waveform Database format (WFDB), the Shared Near Infrared Spectroscopy Format (SNIRF), the Climate and Forecast conventions (CF), Hypertext Transfer Protocol (HTTP), Neurodata Without Borders (NWB), Brain Imaging Data Structure (BIDS).

Questions for commenters

Answer any subset; a short answer with a real file behind it is worth more than a long one without.

The format as a whole

  1. Is anything in the version 2 text ambiguous enough that two careful implementers would write different stores?
  2. Sampling rates that are not integers are rounded in group names and grouping keys today (version 2 open question 5). Do you have recordings where that matters?
  3. Should the core allow codecs other than blosc with zstd for level 0, at the cost of thin readers (open question 14)?
  4. unit, channel_type and modality are free-form strings (open question 11). Which vocabulary would you want them bound to?
  5. Should the format be declared as a registered Zarr convention in root attributes, and what should the declaration look like (open question 4)?
  6. Should the absolute start time of a recording have a defined attribute, given that it can identify a person (open question 10)?
  7. What would stop you from writing a reader in your language or tool?

The package (.bzx)

  1. This proposal requires what RFC-9 only recommends (ZIP64 always, root entry first, entries stored without compression), and adds that every entry is byte-identical to the directory form and that a package is written once. Does any of that lock out a tool you rely on?
  2. Should split archives be forbidden, and should all zarr.json entries precede chunk entries in breadth-first order (open question 27)?
  3. What should the archive comment's encoding and shape be (open question 26)?
  4. Should entry order, timestamps and attributes be fixed, so that two tools packing one store produce identical bytes (open question 28)?
  5. Is a whole-file checksum, a digest manifest or a signature needed before .bzx files circulate, and where should it live (open question 24)?
  6. Should the packing rules share format_version with the store, as recommended, or have a version of their own?
  7. Do you need to read a remote .bzx over HTTP range requests, or only local files?

Names

  1. Does .bzx collide with anything you use (open question 30)?
  2. Is biosig-zarr likely to be confused with the BioSig library, and does that matter?

Irregular and sparse series

  1. For a discontinuous or timestamped recording in a BIDS snapshot, what should RecordingDuration, SamplingFrequency and RecordingType say, and do your events.tsv onsets count gap time?
  2. Are gaps on the grid, with a required interval list, acceptable as the only expression of discontinuity for uniform signals? Who has recordings where it fails (overlapping segments, clocks that step backward), and who can test the GDF, WFDB or SNIRF mappings against real files?
  3. Should valid_intervals be an attribute with a cap of 65,536, or arrays? What is the most fragmented recording you have?
  4. Should the format adopt CF attribute names and dimension names so that xarray decodes a store without help?
  5. Is source_time: null (order known, elapsed time unknown) the right home for undated BrainVision segments, EEGLAB boundary events and concatenated runs? Should epoched data be accepted this way, or refused?
  6. Should integer stores always reserve the most negative code, or is missing_value: null for bit-exact copies worth a second case in every reader?
  7. For jittered streams, which should a public archive serve: timestamps as measured, or a regular grid with the error recorded? Is the largest absolute timing error the statistic you would check?
  8. Are timestamped groups with one shared time array enough for your irregular data? Does anyone need a time per channel inside one group?
  9. Is continuity (continuous, step, instantaneous, unknown) the right vocabulary, and should it also apply to uniform groups?
  10. Are seconds in 64-bit floating point precise enough for time, or do you need integer ticks?
  11. Should a writer be allowed to store a recording whose time base is unknown at all, or must it refuse?

Resolution

  1. Are the two derivation vocabularies complete (the channels' list of lossy steps, and the time array's list of timestamp corrections), and is an empty list a claim you would rely on?
  2. Should int32 and float64 be core storage types, and may a signal reader refuse them?
  3. Should source_adc_bits exist when almost no EEG format states it?
  4. Is the pattern int<N> and uint<N> right for source_sample_type, or should the list be closed?
  5. Do source_step, source_offset and source_digital_range let you restore the source header of the formats you export to? Which format do they fail for?

Why not NWB

  1. Is "Why not NWB on Zarr" a fair description of hdmf-zarr and NWB on Zarr today? What is out of date?
  2. Would a stateless NWB export from a store be useful to you, and which tool would read it?
  3. Are the revisit conditions the right ones?

Reader safety, the timeline and events

  1. Are the four reader-safety layers enough, and is each one testable in your reader? Does any deployed reader you know of slip past all four?
  2. Is one recording timeline with a start_time per uniform group the right model for streams that start at different times, and for a source cut from a longer session?
  3. Is onset_source_basis (timeline, concatenated, unknown) enough to align events in a recording with gaps, and is the onset-to-sample rule the rule you would implement?

Resolution, continued

  1. Should a store also carry an explicit bit-depth attribute for its stored samples, beside dtype and scale, or is dtype enough?

Sub-sample gaps

  1. A gap shorter than one sample period cannot be written in valid_intervals and needs the timestamped kind. Do you have uniform recordings with such gaps, and is that the right home for them?

Closes {{CLOSE_UTC}} UTC. The window is 21 days from the thread's creation. It is short on purpose: NEMAR welcomes review assisted by artificial intelligence when knowledgeable people use it and check what it produces, and with that help a careful review fits in three weeks; one extension of at most 14 days is possible. At most one NEMAR RFC is open for comment at a time.
The record is at {link to text/0001-biosig-zarr.md at its merge commit}.

How to comment. Reply under this RFC's Discussion with a GitHub account. Without one, write to [email protected] before the close; a maintainer posts your comment here with your consent, and with your name only if you agree.


Notes for the shepherd (not part of the opening post):

Round 1 fix (commits 03451d1 and 2b867e8):

  • EDF wording: classic EDF assumes contiguous records; EDF+D can encode irregular samples as timestamped records of duration 0 (EDF+ sections 2.1.1, 2.1.2, 2.2.4); the motivation is preserving and streaming that timing. Problem, prior art and this post no longer rest on "EDF cannot".
  • Required conformance case for the onset rule (owner answer Q30): at 10 Hz with valid_intervals [0,20) and [24,40), the gap runs from 2.00 s to 2.40 s; an event at 2.02 s keeps its onset and returns no acquired sample, though nearest-index rounding gives index 20. Intervals are half-open in sample indices. Gaps shorter than one sample cannot be represented on the grid and need the timestamped kind; new question 40 asks about them (commit 2b867e8).
  • Owner answer Q28: every version 3 reader MUST read version 2 stores, stated as decided; version 1 is expired (commit 2b867e8).
  • Window rationale (AI-assisted review, 21 days, one extension of at most 14) and the one-RFC-at-a-time rule added to "How the decision will be made" and to this post.
  • Resolution: rationale for no new store-side field; source fields marked REQUIRED as designed; new question 39 on a store-side bit-depth attribute.
  • Reader safety: each layer stated as a testable refusal rule; "in effect" defined as in the version 3 text; BCP 14 key words (IETF RFC 2119 and RFC 8174) used for normative reader and writer rules.
  • int16 with a reserved missing code: 65,535 codes, 65,534 steps.
  • Packaging rules with no decision record (stored entries, byte-identical, written once) and NEMAR's download-command choices moved out of "Decided" into open items (question 8) or out of scope.
  • Conformance suite: stated as arriving with the first vectors before opening, with at least one failing case per reader-safety layer.
  • Suggestions: hours figure with its catalog field and the summed seconds; index version note; questions 36 to 38 (reader safety, start_time, onset rule and onset_source_basis); question 28 covers the time array's tokens; question 14 tied to the byte-range rule; values storage type stated; open question 6 closed for integer stores only; archive-comment refusal marked as proposed and tied to question 10; biosigIO also refuses the biosig-zarr name; unsourced "asked more than anything" dropped; issue 1771 comment anchors linked; the BEP 045 sentence reworded; D1 to D12 tags removed; abbreviations defined in this post.
  • Aligned with the version 3 text (Format version 3: the text RFC-0001 proposes biosig-zarr#4 at e2b3ba79): zarr_conventions, the refusal of a version 3 group without kind, the definition of "in effect", and the timestamped values attributes.

Round 2 fix: layer-3 in-effect aligned with the version 3 text (commit b49245f): valid_intervals is in effect when it holds more than one interval, as in the version 3 text.

B4b: points at 3.0.0-draft.2 (commit 72098ad): the comparison is now 2.0.1...3.0.0-draft.2; every 3.0.0-draft.1 mention is now 3.0.0-draft.2; the opening paragraph links schemas/, schemas/v3/, conformance/README.md and manifest.json at that tag and counts 20 vectors, including v3-gap-10hz and v3-gap-exact-copy; a sentence in Problem states that quoted specification text is under the W3C Software and Document License, with a link to LICENSE.md at 2.0.0.

B4c: points at 3.0.0-draft.3, with the independence notice (commits 16b552d, 567ee7f, b600d58 and 0e4947c): the comparison is now 2.0.2...3.0.0-draft.3, and every 3.0.0-draft.2 mention is now 3.0.0-draft.3; the quoted-text notice names the biosig-zarr contributors as the copyright holder, names this RFC's own license, Creative Commons Attribution 4.0 International (CC BY 4.0), and links LICENSE.md at 2.0.2; Problem states that the specification is independent of NEMAR since 2026-11-20 (biosig-zarr Architecture Decision Record (ADR) 0005): its editor decides under its GOVERNANCE.md, and NEMAR is its origin, first implementer and host, which backstops it and guarantees its continuation without deciding it; the packing rules are the specification's own, the version 2 reading rule is decided by the specification's editor, and the specification's editor decides this RFC; the release Digital Object Identifier (DOI) is issued through nemar-doi, which registers it and does not own it; a new row under "Decided, and out of scope for comment", a 2.0.2 row in "History of the format" and a change log line record the change. Gates run on head: bun run lint, bun run typecheck, bun test (140 pass), bun run src/check.ts (rfc-check: ok), uvx typos text/ (exit 0).

B4d: the back catalog count (commits 326fcbd and b6bbb3c): the promise to count the affected recordings is replaced by the counts of a read-only scan of the public catalog, linked through the public tag rfc-0001-evidence in nemarOrg/nemar-cli (commit c48405fe); Summary gains one sentence (at least 978 stores converted from a source with a measured gap); Problem states 978 of the 231,259 stores (0.42%) from 36 datasets, 547 more that can be discontinuous (528 undated BrainVision segments, 19 with overlapping or backward segment dates), the two EDF+D stores whose dropped gap is inferred from the index and labeled so, and that the counts are lower bounds; the re-conversion bullet states at least 1,525 stores in 56 datasets; the interim EDF+D refusal bullet states what it concerns in the catalog (nm000456); the 2, independent row of "History of the format" keeps 2026-11-20 and says the 2.0.2 release was on 2026-11-21; a References line and a change log line record the evidence. Gates run on head b6bbb3c: bun run lint (no fixes applied), bun run typecheck, bun test (140 pass, 0 fail), bun run src/check.ts (rfc-check: ok), uvx typos text/ (exit 0); every Acceptance grep returned its expected count.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant