Skip to content

Commit

Permalink
docstring and tutorial editions
Browse files Browse the repository at this point in the history
  • Loading branch information
h-mayorquin committed Nov 16, 2024
1 parent a5ca2ef commit d1064c0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
5 changes: 3 additions & 2 deletions docs/gallery/general/plot_read_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,9 @@
nwbfile

#######################################
# For more advance use, use the :py:class:`~pynwb.NWBHDF5IO`. Here, we show how it can be used as a context manager
# to read data from an NWB file in a more controlled way:
# For more advanced use cases, the :py:class:~pynwb.NWBHDF5IO class provides additional functionality.
# Below, we demonstrate how :py:class:~pynwb.NWBHDF5IO can be used as a context manager
# to read data from an NWB file in a more controlled manner:

from pynwb import NWBHDF5IO
with NWBHDF5IO(filepath, mode="r") as io2:
Expand Down
7 changes: 3 additions & 4 deletions src/pynwb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,9 +540,9 @@ def read_nwb(**kwargs):
def read_nwb(**kwargs):
"""Read an NWB file from a local path or remote URL.
Provides a simple, high-level interface for reading NWB files in the most
common use cases. Automatically handles both HDF5 and Zarr formats.
For advanced use cases (parallel I/O, custom namespaces), use NWBHDF5IO or NWBZarrIO.
High-level interface for reading NWB files. Automatically handles both HDF5
and Zarr formats. For advanced use cases (parallel I/O, custom namespaces),
use NWBHDF5IO or NWBZarrIO.
Parameters
----------
Expand All @@ -566,7 +566,6 @@ def read_nwb(**kwargs):
* Always opens in read-only mode
* Automatically loads namespaces
* Detects file format based on extension
* Automatically handles local and remote paths
Advanced features requiring direct use of IO classes include:
* Streaming data from s3
Expand Down
6 changes: 2 additions & 4 deletions tests/integration/hdf5/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,7 @@ def test_read_nwb_method_file(self):
io.write(self.nwbfile)

import h5py

file = h5py.File(self.path, 'r')

read_nwbfile = NWBHDF5IO.read_nwb(file=file)
Expand All @@ -626,7 +627,4 @@ def test_read_nwb_method_s3_path(self):
read_nwbfile = NWBHDF5IO.read_nwb(path=s3_test_path)
assert read_nwbfile.identifier == "3f77c586-6139-4777-a05d-f603e90b1330"

assert read_nwbfile.subject.subject_id == "1"



assert read_nwbfile.subject.subject_id == "1"

0 comments on commit d1064c0

Please sign in to comment.