Skip to content

Zarr converter fails on mixed-sampling-rate EDF/BDF (polysomnography) #737

Closed

Description

@neuromechanist

Zarr converter cannot handle mixed-sampling-rate EDF/BDF recordings

Surfaced while debugging the nm000111 publish cascade (#736), but it is a distinct bug in the Zarr serving-copy converter, not part of the post-publish robustness work.

Symptom

A forced Zarr conversion of nm000111 (ISRUC-Sleep, polysomnography) on the now-public dataset failed on all 126 recordings:

conversion failed for sub-I001/.../sub-I001_task-sleep_eeg.edf:
  Error reading EDF file: Length of values (333375) does not match length of index (5334000)
...
all 126 conversion(s) failed; index left untouched
filesize 91778304 != 10900*13200+5120

Root cause

5334000 / 333375 = 16.0 exactly, across every recording. ISRUC-Sleep mixes per-channel sampling rates (EEG/EOG/EMG ~200 Hz, respiratory/SpO2 ~12.5 Hz; 200 / 12.5 = 16). scripts/zarr/generate_zarr.py builds a single time index at the maximum channel rate, so the slower channels' value arrays don't align with that index and the read raises. This is a real (not corrupt) PSG montage that any standard reader (MNE) handles by reading per-channel; the converter's single-rate assumption is the gap.

Scope

  • Decide the serving model for heterogeneous-rate recordings: per-channel-rate groups, resample-to-common-rate, or per-rate Zarr arrays.
  • Apply the same fix to BDF (BioSemi) which has the same multi-rate header model.
  • Add a mixed-rate fixture to the converter tests so this regressions-guards.

Repo: nemarDatasets/.github (scripts/zarr/generate_zarr.py). Tracked separately from #736 per maintainer.

Activity

  1. added
    bug
    on Jun 11, 2026
  2. neuromechanist commented on Jun 11, 2026

    @neuromechanist
    ContributorAuthor

    Maintainer note: likely a biosigIO problem (the EDF/BDF reader used by the converter), not the converter's index logic per se. Investigate biosigIO's handling of heterogeneous per-channel sampling rates first. Handled outside the #736 robustness epic.

  3. neuromechanist commented on Jun 18, 2026

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions