Skip to content

ENH: read_raw_nwb for one ElectricalSeries (h5py, lazy) #14521

Open

Description

@bruAristimunha

Scoped first step for #10427.

mne.io.read_raw_nwb(fname) reads the one ElectricalSeries in acquisition/ (or, if there is none, the one 2-D TimeSeries in volts) as a lazy Raw.

  • h5py only, like read_raw_snirf; no pynwb
  • volts = data × conversion × channel_conversion (V, mV, µV)
  • meas_date = timestamps_reference_time (or session_start_time) + starting_time
  • sfreq = starting_time.rate, or the nominal rate of regular timestamps
  • channel names: electrode ids
  • clear error for: several series, non-voltage units, offset != 0, irregular timestamps

Not in scope: positions (NWB gives no coordinate frame), subject, trials → annotations, extensions.

Working version (~140 lines + tests), used on the NWB iEEG recordings hosted on OpenNeuro/NEMAR: https://github.com/eegdash/EEGDash/blob/develop/eegdash/io/nwb.py

One question before the PR: NWB has no channel-type field. Should the default be seeg, ecog, or misc?

Activity

  1. larsoner commented on Nov 11, 2026

    @larsoner
    Member

    For the reader I think you could have ch_type="seeg" (or "ecog") as the default, and that allows you to pick it at read time. Or we just pick one and tell people to use set_channel_types afterward. I wouldn't use misc as the default since that's not a "data" channel type.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions