Skip to content

Commit

Permalink
Merge branch 'dev' into streaming_add_remfile2
Browse files Browse the repository at this point in the history
  • Loading branch information
bendichter authored Nov 29, 2023
2 parents 2a70ca9 + 5e8ddc2 commit b3591ed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
4 changes: 2 additions & 2 deletions docs/gallery/advanced_io/streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
# next, open the file
with fs.open(s3_url, "rb") as f:
with h5py.File(f) as file:
with pynwb.NWBHDF5IO(file=file, load_namespaces=True) as io:
with pynwb.NWBHDF5IO(file=file) as io:
nwbfile = io.read()
print(nwbfile.acquisition['lick_times'].time_series['lick_left_times'].data[:])

Expand Down Expand Up @@ -99,7 +99,7 @@

from pynwb import NWBHDF5IO

with NWBHDF5IO(s3_url, mode='r', load_namespaces=True, driver='ros3') as io:
with NWBHDF5IO(s3_url, mode='r', driver='ros3') as io:
nwbfile = io.read()
print(nwbfile)
print(nwbfile.acquisition['lick_times'].time_series['lick_left_times'].data[:])
Expand Down
15 changes: 5 additions & 10 deletions docs/gallery/general/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,16 +248,11 @@ def __init__(self, **kwargs):
# .. note::
#
# For more information on writing NWB files, see :ref:`basic_writing`.

####################
# By default, PyNWB does not use the namespaces cached in a file--you must
# explicitly specify this. This behavior is enabled by the *load_namespaces*
# argument to the :py:class:`~pynwb.NWBHDF5IO` constructor.

with NWBHDF5IO("cache_spec_example.nwb", mode="r") as io:
nwbfile = io.read()

####################
#
# By default, if a namespace is not already loaded, PyNWB loads the namespace cached in
# the file. To disable this, set ``load_namespaces=False`` in the
# :py:class:`~pynwb.NWBHDF5IO` constructor.
#
# .. _MultiContainerInterface:
#
# Creating and using a custom MultiContainerInterface
Expand Down
4 changes: 2 additions & 2 deletions docs/gallery/general/plot_read_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@

filepath = "sub-P11HMH_ses-20061101_ecephys+image.nwb"
# Open the file in read mode "r",
io = NWBHDF5IO(filepath, mode="r", load_namespaces=True)
io = NWBHDF5IO(filepath, mode="r")
nwbfile = io.read()
nwbfile

#######################################
# :py:class:`~pynwb.NWBHDF5IO` can also be used as a context manager:

with NWBHDF5IO(filepath, mode="r", load_namespaces=True) as io2:
with NWBHDF5IO(filepath, mode="r") as io2:
nwbfile2 = io2.read()

# data accessible here
Expand Down

0 comments on commit b3591ed

Please sign in to comment.