Skip to content

[Feature]: Add read_nwb to simplify reading nwbfiles  #1974

@h-mayorquin

Description

@h-mayorquin

What would you like to see added to PyNWB?

This is a comment that I have gotten from various users: reading and nwbfile is not as easy as it could be.

At the moment, when I google "how to read and nwbfile", the results show a suggestion to use NWBHDF5IO. This is also what we have on the tutorial.

While the IO approach is flexible, powerful, and follows good practices (i.e., it can be used as a context manager) it also suffers from what I think are several problems that detract from usability:

  1. It has too many options: path, file, region, mode, manager, etc.
  2. It is hard to remember the name to import.
  3. It does not read zarr.
  4. It requires two method calls, first instantiating the IO and then using read on the IO.

What solution would you like?

I think that we could provide users with a simple entry point that covers most cases and leave the IO approach as the power tool behind the scenes:

from pynwb import read_nwb

nwbfile = read_nwb(file_path)

I think the name is easier to remember and intuitive about what it does.

For simplicity, this function should:

  • Work only paths
  • Always on read mode
  • Open both zarr and hdf5.
  • load_namespaces=True
  • If we are ambitious we can have a default streaming choice if a link to dandi s3 asset is passed.

Downsides?

Do you have any interest in helping implement the feature?

Yes.

Code of Conduct

Metadata

Metadata

Assignees

Labels

category: proposalproposed enhancements or new featurespriority: lowalternative solution already working and/or relevant to only specific user(s)

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions