Skip to content

Commit 8eb9a36

Browse files
authored
Up/strem tutorial (#1762)
* Update text in streaming tutorial * Fix bad intendation warning for plot_file.py tutorial * Fix broken references to basic_trials section to point to time_intervals instead * Fix sphinx lexer warning in mock.rst due to python code block containing non-python output * Updated Changelog
1 parent c26f9e0 commit 8eb9a36

File tree

6 files changed

+44
-34
lines changed

6 files changed

+44
-34
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
- Add `TimeSeries.get_timestamps()`. @bendichter [#1741](https://github.com/NeurodataWithoutBorders/pynwb/pull/1741)
77
- Add `TimeSeries.get_data_in_units()`. @bendichter [#1745](https://github.com/NeurodataWithoutBorders/pynwb/pull/1745)
88

9+
### Documentation and tutorial enhancements
10+
- Updated streaming tutorial to ensure code is run on tests and clarify text. @bendichter [#1760](https://github.com/NeurodataWithoutBorders/pynwb/pull/1760) @oruebel [#1762](https://github.com/NeurodataWithoutBorders/pynwb/pull/1762)
11+
- Fixed minor documentation build warnings and broken links to `basic_trials` tutorial @oruebel [#1762](https://github.com/NeurodataWithoutBorders/pynwb/pull/1762)
12+
913
## PyNWB 2.4.1 (July 26, 2023)
1014
- Stop running validation tests as part of integration tests. They cause issues in CI and can be run separately. @rly [#1740](https://github.com/NeurodataWithoutBorders/pynwb/pull/1740)
1115

docs/gallery/advanced_io/streaming.py

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -92,22 +92,10 @@
9292
#
9393
# Streaming Method 2: ROS3
9494
# ------------------------
95-
# ROS3 is one of the supported methods for reading data from a remote store. ROS3 stands for "read only S3" and is a
96-
# driver created by the HDF5 Group that allows HDF5 to read HDF5 files stored remotely in s3 buckets. Using this method
97-
# requires that your HDF5 library is installed with the ROS3 driver enabled. This is not the default configuration,
98-
# so you will need to make sure you install the right version of ``h5py`` that has this advanced configuration enabled.
99-
# You can install HDF5 with the ROS3 driver from `conda-forge <https://conda-forge.org/>`_ using ``conda``. You may
100-
# first need to uninstall a currently installed version of ``h5py``.
101-
#
102-
# .. code-block:: bash
103-
#
104-
# pip uninstall h5py
105-
# conda install -c conda-forge "h5py>=3.2"
106-
#
107-
# Now instantiate a :py:class:`~pynwb.NWBHDF5IO` object with the S3 URL and specify the driver as "ros3". This
108-
# will download metadata about the file from the S3 bucket to memory. The values of datasets are accessed lazily,
109-
# just like when reading an NWB file stored locally. So, slicing into a dataset will require additional time to
110-
# download the sliced data (and only the sliced data) to memory.
95+
# ROS3 stands for "read only S3" and is a driver created by the HDF5 Group that allows HDF5 to read HDF5 files stored
96+
# remotely in s3 buckets. Using this method requires that your HDF5 library is installed with the ROS3 driver enabled.
97+
# With ROS3 support enabled in h5py, we can instantiate a :py:class:`~pynwb.NWBHDF5IO` object with the S3 URL and
98+
# specify the driver as "ros3".
11199

112100
from pynwb import NWBHDF5IO
113101

@@ -116,18 +104,35 @@
116104
print(nwbfile)
117105
print(nwbfile.acquisition['lick_times'].time_series['lick_left_times'].data[:])
118106

107+
##################################
108+
# This will download metadata about the file from the S3 bucket to memory. The values of datasets are accessed lazily,
109+
# just like when reading an NWB file stored locally. So, slicing into a dataset will require additional time to
110+
# download the sliced data (and only the sliced data) to memory.
111+
#
112+
# .. note::
113+
#
114+
# Pre-built h5py packages on PyPI do not include this S3 support. If you want this feature, you could use packages
115+
# from conda-forge, or build h5py from source against an HDF5 build with S3 support. You can install HDF5 with
116+
# the ROS3 driver from `conda-forge <https://conda-forge.org/>`_ using ``conda``. You may
117+
# first need to uninstall a currently installed version of ``h5py``.
118+
#
119+
# .. code-block:: bash
120+
#
121+
# pip uninstall h5py
122+
# conda install -c conda-forge "h5py>=3.2"
123+
124+
119125
##################################################
120126
# Which streaming method to choose?
121127
# ---------------------------------
122128
#
123-
# fsspec has many advantages over ros3:
124-
#
125-
# 1. fsspec is easier to install
126-
# 2. fsspec supports caching, which will dramatically speed up repeated requests for the
127-
# same region of data
128-
# 3. fsspec automatically retries when s3 fails to return.
129-
# 4. fsspec works with other storage backends and
130-
# 5. fsspec works with other types of files.
131-
# 6. In our hands, fsspec is faster out-of-the-box.
129+
# From a user perspective, once opened, the :py:class:`~pynwb.file.NWBFile` works the same with
130+
# both fsspec and ros3. However, in general, we currently recommend using fsspec for streaming
131+
# NWB files because it is more performant and reliable than ros3. In particular fsspec:
132132
#
133-
# For these reasons, we would recommend use fsspec for most Python users.
133+
# 1. supports caching, which will dramatically speed up repeated requests for the
134+
# same region of data,
135+
# 2. automatically retries when s3 fails to return, which helps avoid errors when accessing data due to
136+
# intermittent errors in connections with S3,
137+
# 3. works also with other storage backends (e.g., GoogleDrive or Dropbox, not just S3) and file formats, and
138+
# 4. in our experience appears to provide faster out-of-the-box performance than the ros3 driver.

docs/gallery/domain/plot_behavior.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
# .. note::
101101
# :py:class:`~pynwb.behavior.SpatialSeries` data should be stored as one continuous stream,
102102
# as it is acquired, not by trial as is often reshaped for analysis.
103-
# Data can be trial-aligned on-the-fly using the trials table. See the :ref:`basic_trials` tutorial
103+
# Data can be trial-aligned on-the-fly using the trials table. See the :ref:`time_intervals` tutorial
104104
# for further information.
105105
#
106106
# For position data ``reference_frame`` indicates the zero-position, e.g.

docs/gallery/general/plot_file.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,11 @@
122122
NWB organizes data into different groups depending on the type of data. Groups can be thought of
123123
as folders within the file. Here are some of the groups within an :py:class:`~pynwb.file.NWBFile` and the types of
124124
data they are intended to store:
125-
* **acquisition**: raw, acquired data that should never change
126-
* **processing**: processed data, typically the results of preprocessing algorithms and could change
127-
* **analysis**: results of data analysis
128-
* **stimuli**: stimuli used in the experiment (e.g., images, videos, light pulses)
125+
126+
* **acquisition**: raw, acquired data that should never change
127+
* **processing**: processed data, typically the results of preprocessing algorithms and could change
128+
* **analysis**: results of data analysis
129+
* **stimuli**: stimuli used in the experiment (e.g., images, videos, light pulses)
129130
130131
The following examples will reference variables that may not be defined within the block they are used in. For
131132
clarity, we define them here:

docs/gallery/general/plot_read_basics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@
246246
# and additional metadata.
247247
#
248248
# .. seealso::
249-
# You can learn more about trials in the :ref:`basic_trials` tutorial section.
249+
# You can learn more about trials in the :ref:`time_intervals` tutorial.
250250
#
251251
# Similarly to :py:class:`~pynwb.misc.Units`, we can view trials as a :py:class:`pandas.DataFrame`.
252252

docs/source/testing/mock.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ If you want to create objects and automatically add them to an :py:class:`~pynwb
4242
4343
Now this NWBFile contains an :py:class:`~pynwb.ophys.RoiResponseSeries` and all the upstream classes:
4444

45-
.. code-block:: python
45+
.. code-block::
4646
47-
print(nwbfile)
47+
>>> print(nwbfile)
4848
4949
root pynwb.file.NWBFile at 0x4335131760
5050
Fields:

0 commit comments

Comments
 (0)