From 7ba35d692582e19fd9d97061aa1e0dd45039d58f Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Thu, 11 Jan 2024 14:05:11 -0800 Subject: [PATCH 01/16] add zarr intersphinx mapping --- docs/source/conf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/source/conf.py b/docs/source/conf.py index 143d9d2c6..2ac366366 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -148,6 +148,7 @@ def __call__(self, filename): 'fsspec': ("https://filesystem-spec.readthedocs.io/en/latest/", None), 'nwbwidgets': ("https://nwb-widgets.readthedocs.io/en/latest/", None), 'nwb-overview': ("https://nwb-overview.readthedocs.io/en/latest/", None), + 'zarr': ("https://zarr.readthedocs.io/en/stable/", None), } extlinks = { From 29a9f5c88216c9137fb00e746b77dcad557fc13d Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Thu, 11 Jan 2024 15:41:48 -0800 Subject: [PATCH 02/16] fix space typos --- src/pynwb/base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pynwb/base.py b/src/pynwb/base.py index 42f7b7ff3..d539c680a 100644 --- a/src/pynwb/base.py +++ b/src/pynwb/base.py @@ -514,7 +514,7 @@ class TimeSeriesReferenceVectorData(VectorData): then this indicates an invalid link (in practice both ``idx_start`` and ``count`` must always either both be positive or both be negative). When selecting data via the :py:meth:`~pynwb.base.TimeSeriesReferenceVectorData.get` or - :py:meth:`~pynwb.base. TimeSeriesReferenceVectorData.__getitem__` + :py:meth:`~pynwb.base.TimeSeriesReferenceVectorData.__getitem__` functions, ``(-1, -1, TimeSeries)`` values are replaced by the corresponding :py:class:`~pynwb.base.TimeSeriesReferenceVectorData.TIME_SERIES_REFERENCE_NONE_TYPE` tuple to avoid exposing NWB storage internals to the user and simplifying the use of and checking @@ -527,11 +527,11 @@ class TimeSeriesReferenceVectorData(VectorData): TIME_SERIES_REFERENCE_TUPLE = TimeSeriesReference """Return type when calling :py:meth:`~pynwb.base.TimeSeriesReferenceVectorData.get` or - :py:meth:`~pynwb.base. TimeSeriesReferenceVectorData.__getitem__`.""" + :py:meth:`~pynwb.base.TimeSeriesReferenceVectorData.__getitem__`.""" TIME_SERIES_REFERENCE_NONE_TYPE = TIME_SERIES_REFERENCE_TUPLE(None, None, None) """Tuple used to represent None values when calling :py:meth:`~pynwb.base.TimeSeriesReferenceVectorData.get` or - :py:meth:`~pynwb.base. TimeSeriesReferenceVectorData.__getitem__`. See also + :py:meth:`~pynwb.base.TimeSeriesReferenceVectorData.__getitem__`. See also :py:class:`~pynwb.base.TimeSeriesReferenceVectorData.TIME_SERIES_REFERENCE_TUPLE`""" @docval({'name': 'name', 'type': str, 'doc': 'the name of this VectorData', 'default': 'timeseries'}, From 45ed9a71e5490ab6d608ddd99c49e3e64d0c5cd7 Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Wed, 17 Jan 2024 10:28:24 -0800 Subject: [PATCH 03/16] update links in tutorials --- docs/gallery/advanced_io/h5dataio.py | 2 +- docs/gallery/domain/images.py | 9 +++--- docs/gallery/domain/ophys.py | 4 +-- docs/gallery/domain/plot_icephys.py | 13 ++++---- docs/gallery/general/add_remove_containers.py | 8 ++--- docs/gallery/general/object_id.py | 2 +- docs/gallery/general/plot_file.py | 4 +-- docs/gallery/general/plot_timeintervals.py | 30 ++++++++----------- 8 files changed, 33 insertions(+), 39 deletions(-) diff --git a/docs/gallery/advanced_io/h5dataio.py b/docs/gallery/advanced_io/h5dataio.py index fd3548e4b..3b4391655 100644 --- a/docs/gallery/advanced_io/h5dataio.py +++ b/docs/gallery/advanced_io/h5dataio.py @@ -34,7 +34,7 @@ #################### -# Normally if we create a :py:class:`~pynwb.file.TimeSeries` we would do +# Normally if we create a :py:class:`~pynwb.base.TimeSeries` we would do import numpy as np diff --git a/docs/gallery/domain/images.py b/docs/gallery/domain/images.py index 8b59b75f0..df7e36f59 100644 --- a/docs/gallery/domain/images.py +++ b/docs/gallery/domain/images.py @@ -190,7 +190,7 @@ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # # :py:class:`~pynwb.image.RGBAImage` is for storing data of color image with transparency. -# :py:attr:`~pynwb.image.RGBAImage.data` must be 3D where the first and second dimensions +# `RGBAImage.data` must be 3D where the first and second dimensions # represent x and y. The third dimension has length 4 and represents the RGBA value. # @@ -208,7 +208,7 @@ # ^^^^^^^^^^^^^^^^^^^^^^^^^^ # # :py:class:`~pynwb.image.RGBImage` is for storing data of RGB color image. -# :py:attr:`~pynwb.image.RGBImage.data` must be 3D where the first and second dimensions +# `RGBImage.data` must be 3D where the first and second dimensions # represent x and y. The third dimension has length 3 and represents the RGB value. # @@ -224,8 +224,7 @@ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # # :py:class:`~pynwb.image.GrayscaleImage` is for storing grayscale image data. -# :py:attr:`~pynwb.image.GrayscaleImage.data` must be 2D where the first and second dimensions -# represent x and y. +# `GrayscaleImage.data` must be 2D where the first and second dimensions represent x and y. # gs_logo = GrayscaleImage( @@ -300,7 +299,7 @@ #################### # Here `data` contains the (0-indexed) index of the displayed image as they are ordered -# in the :py:class:`~pynwb.base.ImageReference`. +# in the :py:class:`~pynwb.base.ImageReferences`. # # Writing the images to an NWB File # --------------------------------------- diff --git a/docs/gallery/domain/ophys.py b/docs/gallery/domain/ophys.py index b8ddb1ae5..f5058619e 100644 --- a/docs/gallery/domain/ophys.py +++ b/docs/gallery/domain/ophys.py @@ -540,7 +540,7 @@ # Data arrays are read passively from the file. # Calling the data attribute on a :py:class:`~pynwb.base.TimeSeries` # such as a :py:class:`~pynwb.ophys.RoiResponseSeries` does not read the data -# values, but presents an :py:class:`~h5py` object that can be indexed to read data. +# values, but presents an `h5py` object that can be indexed to read data. # You can use the ``[:]`` operator to read the entire data array into memory. # Load and print all the data values of the :py:class:`~pynwb.ophys.RoiResponseSeries` # object representing the fluorescence data. @@ -558,7 +558,7 @@ # # It is often preferable to read only a portion of the data. To do this, index # or slice into the data attribute just like if you were indexing or slicing a -# :py:class:`~numpy` array. +# :py:mod:`numpy` array. # # The following code prints elements ``0:10`` in the first dimension (time) # and ``0:3`` (ROIs) in the second dimension from the fluorescence data we have written. diff --git a/docs/gallery/domain/plot_icephys.py b/docs/gallery/domain/plot_icephys.py index 109ec5fcc..410375909 100644 --- a/docs/gallery/domain/plot_icephys.py +++ b/docs/gallery/domain/plot_icephys.py @@ -350,7 +350,7 @@ ##################################################################### # .. note:: Since :py:meth:`~pynwb.file.NWBFile.add_intracellular_recording` can automatically add # the objects to the NWBFile we do not need to separately call -# :py:meth:`~pynwb.file.NWBFile.add_stimulus` and :py:meth:`~pynwb.file.NWBFile.add_acquistion` +# :py:meth:`~pynwb.file.NWBFile.add_stimulus` and :py:meth:`~pynwb.file.NWBFile.add_acquisition` # to add our stimulus and response, but it is still fine to do so. # # .. note:: The ``id`` parameter in the call is optional and if the ``id`` is omitted then PyNWB will @@ -495,8 +495,7 @@ # .. note:: The same process applies to all our other tables as well. We can use the # corresponding :py:meth:`~pynwb.file.NWBFile.get_intracellular_recordings`, # :py:meth:`~pynwb.file.NWBFile.get_icephys_sequential_recordings`, -# :py:meth:`~pynwb.file.NWBFile.get_icephys_repetitions`, and -# :py:meth:`~pynwb.file.NWBFile.get_icephys_conditions` functions instead. +# :py:meth:`~pynwb.file.NWBFile.get_icephys_repetitions` functions instead. # In general, we can always use the get functions instead of accessing the property # of the file. # @@ -507,7 +506,7 @@ # # Add a single simultaneous recording consisting of a set of intracellular recordings. # Again, setting the id for a simultaneous recording is optional. The recordings -# argument of the :py:meth:`~pynwb.file.NWBFile.add_simultaneous_recording` function +# argument of the :py:meth:`~pynwb.file.NWBFile.add_icephys_simultaneous_recording` function # here is simply a list of ints with the indices of the corresponding rows in # the :py:class:`~pynwb.icephys.IntracellularRecordingsTable` # @@ -564,7 +563,7 @@ # Add a single sequential recording consisting of a set of simultaneous recordings. # Again, setting the id for a sequential recording is optional. Also this table is # optional and will be created automatically by NWBFile. The ``simultaneous_recordings`` -# argument of the :py:meth:`~pynwb.file.NWBFile.add_sequential_recording` function +# argument of the :py:meth:`~pynwb.file.NWBFile.add_icephys_sequential_recording` function # here is simply a list of ints with the indices of the corresponding rows in # the :py:class:`~pynwb.icephys.SimultaneousRecordingsTable`. @@ -579,7 +578,7 @@ # Add a single repetition consisting of a set of sequential recordings. Again, setting # the id for a repetition is optional. Also this table is optional and will be created # automatically by NWBFile. The ``sequential_recordings argument`` of the -# :py:meth:`~pynwb.file.NWBFile.add_sequential_recording` function here is simply +# :py:meth:`~pynwb.file.NWBFile.add_icephys_repetition` function here is simply # a list of ints with the indices of the corresponding rows in # the :py:class:`~pynwb.icephys.SequentialRecordingsTable`. @@ -592,7 +591,7 @@ # Add a single experimental condition consisting of a set of repetitions. Again, # setting the id for a condition is optional. Also this table is optional and # will be created automatically by NWBFile. The ``repetitions`` argument of -# the :py:meth:`~pynwb.file.NWBFile.add_icephys_condition` function again is +# the :py:meth:`~pynwb.file.NWBFile.add_icephys_experimental_condition` function again is # simply a list of ints with the indices of the correspondingto rows in the # :py:class:`~pynwb.icephys.RepetitionsTable`. diff --git a/docs/gallery/general/add_remove_containers.py b/docs/gallery/general/add_remove_containers.py index 80c5cb032..58611dd23 100644 --- a/docs/gallery/general/add_remove_containers.py +++ b/docs/gallery/general/add_remove_containers.py @@ -75,9 +75,9 @@ # NWB datasets that have been written to disk are read as :py:class:`h5py.Dataset ` objects. # Directly modifying the data in these :py:class:`h5py.Dataset ` objects immediately # modifies the data on disk -# (the :py:meth:`NWBHDF5IO.write ` method does not need to be called and the -# :py:class:`~pynwb.NWBHDF5IO` instance does not need to be closed). Directly modifying datasets in this way -# can lead to files that do not validate or cannot be opened, so exercise caution when using this method. +# (the :py:meth:`NWBHDF5IO.write ` method does not need to be +# called and the :py:class:`~pynwb.NWBHDF5IO` instance does not need to be closed). Directly modifying datasets in +# this way can lead to files that do not validate or cannot be opened, so exercise caution when using this method. # Note: only chunked datasets or datasets with ``maxshape`` set can be resized. # See the `h5py chunked storage documentation `_ # for more details. @@ -96,7 +96,7 @@ # have raw data and processed data in the same NWB file and you want to create a new NWB file with all of the # contents of the original file except for the raw data for sharing with collaborators. # -# To remove existing containers, use the :py:class:`~hdmf.utils.LabelledDict.pop` method on any +# To remove existing containers, use the :py:meth:`~hdmf.utils.LabelledDict.pop` method on any # :py:class:`~hdmf.utils.LabelledDict` object, such as ``NWBFile.acquisition``, ``NWBFile.processing``, # ``NWBFile.analysis``, ``NWBFile.processing``, ``NWBFile.scratch``, ``NWBFile.devices``, ``NWBFile.stimulus``, # ``NWBFile.stimulus_template``, ``NWBFile.electrode_groups``, ``NWBFile.imaging_planes``, diff --git a/docs/gallery/general/object_id.py b/docs/gallery/general/object_id.py index 206142715..a4de45625 100644 --- a/docs/gallery/general/object_id.py +++ b/docs/gallery/general/object_id.py @@ -10,7 +10,7 @@ unique and used widely across computing platforms as if they are unique. The object ID of an NWB container object can be accessed using the -:py:meth:`~hdmf.container.AbstractContainer.object_id` method. +:py:attr:`~hdmf.container.AbstractContainer.object_id` method. .. _UUID: https://en.wikipedia.org/wiki/Universally_unique_identifier diff --git a/docs/gallery/general/plot_file.py b/docs/gallery/general/plot_file.py index beead22f6..154991877 100644 --- a/docs/gallery/general/plot_file.py +++ b/docs/gallery/general/plot_file.py @@ -24,7 +24,7 @@ * :ref:`modules_overview`, i.e., objects for storing and grouping analyses, and * experiment metadata and other metadata related to data provenance. -The following sections describe the :py:class:`~pynwb.base.TimeSeries` and :py:class:`~pynwb.base.ProcessingModules` +The following sections describe the :py:class:`~pynwb.base.TimeSeries` and :py:class:`~pynwb.base.ProcessingModule` classes in further detail. .. _timeseries_overview: @@ -569,7 +569,7 @@ #################### # :py:class:`~hdmf.common.table.DynamicTable` and its subclasses can be converted to a pandas -# :py:class:`~pandas.DataFrame` for convenient analysis using :py:meth:`.DynamicTable.to_dataframe`. +# :py:class:`~pandas.DataFrame` for convenient analysis using :py:meth:`~hdmf.common.table.DynamicTable.to_dataframe`. nwbfile.trials.to_dataframe() diff --git a/docs/gallery/general/plot_timeintervals.py b/docs/gallery/general/plot_timeintervals.py index a04a400c5..69f9bf626 100644 --- a/docs/gallery/general/plot_timeintervals.py +++ b/docs/gallery/general/plot_timeintervals.py @@ -9,16 +9,14 @@ :py:class:`~pynwb.epoch.TimeIntervals` type. The :py:class:`~pynwb.epoch.TimeIntervals` type is a :py:class:`~hdmf.common.table.DynamicTable` with the following columns: -1. :py:meth:`~pynwb.epoch.TimeIntervals.start_time` and :py:meth:`~pynwb.epoch.TimeIntervals.stop_time` - describe the start and stop times of intervals as floating point offsets in seconds relative to the - :py:meth:`~pynwb.file.NWBFile.timestamps_reference_time` of the file. In addition, -2. :py:class:`~pynwb.epoch.TimeIntervals.tags` is an optional, indexed column used to associate user-defined string - tags with intervals (0 or more tags per time interval) -3. :py:class:`~pynwb.epoch.TimeIntervals.timeseries` is an optional, indexed - :py:class:`~pynwb.base.TimeSeriesReferenceVectorData` column to map intervals directly to ranges in select, - relevant :py:class:`~pynwb.base.TimeSeries` (0 or more per time interval) +1. `start_time` and `stop_time` describe the start and stop times of intervals as floating point offsets in seconds + relative to the :py:meth:`~pynwb.file.NWBFile.timestamps_reference_time` of the file. In addition, +2. `tags` is an optional, indexed column used to associate user-defined string tags with intervals (0 or more tags per + time interval) +3. `timeseries` is an optional, indexed :py:class:`~pynwb.base.TimeSeriesReferenceVectorData` column to map intervals + directly to ranges in select, relevant :py:class:`~pynwb.base.TimeSeries` (0 or more per time interval) 4. as a :py:class:`~hdmf.common.table.DynamicTable` user may add additional columns to - :py:meth:`~pynwb.epoch.TimeIntervals` via :py:class:`~hdmf.common.table.DynamicTable.add_column` + :py:meth:`~pynwb.epoch.TimeIntervals` via :py:meth:`~hdmf.common.table.DynamicTable.add_column` .. hint:: :py:meth:`~pynwb.epoch.TimeIntervals` is intended for storing general annotations of time ranges. @@ -84,12 +82,10 @@ # ^^^^^^ # # Trials can be added to an NWB file using the methods :py:meth:`~pynwb.file.NWBFile.add_trial` -# By default, NWBFile only requires trial :py:meth:`~pynwb.file.NWBFile.add_trial.start_time` -# and :py:meth:`~pynwb.file.NWBFile.add_trial.end_time`. The :py:meth:`~pynwb.file.NWBFile.add_trial.tags` -# and :py:meth:`~pynwb.file.NWBFile.add_trial.timeseries` are optional. For -# :py:meth:`~pynwb.file.NWBFile.add_trial.timeseries` we only need to supply the :py:class:`~pynwb.base.TimeSeries`. +# By default, NWBFile only requires trial `start_time` and `stop_time`. The `tags` and `timeseries` are optional. For +# `timeseries` we only need to supply the :py:class:`~pynwb.base.TimeSeries`. # PyNWB automatically calculates the corresponding index range (described by ``idx_start`` and ``count``) for -# the supplied :py:class:`~pynwb.base.TimeSeries based on the given ``start_time`` and ``stop_time`` and +# the supplied :py:class:`~pynwb.base.TimeSeries` based on the given ``start_time`` and ``stop_time`` and # the :py:meth:`~pynwb.base.TimeSeries.timestamps` (or :py:class:`~pynwb.base.TimeSeries.starting_time` # and :py:meth:`~pynwb.base.TimeSeries.rate`) of the given :py:class:`~pynwb.base.TimeSeries`. # @@ -199,7 +195,7 @@ # # To define custom, experiment-specific :py:class:`~pynwb.epoch.TimeIntervals` we can add them # either: 1) when creating the :py:class:`~pynwb.file.NWBFile` by defining the -# :py:meth:`~pynwb.file.NWBFile.__init__.intervals` constructor argument or 2) via the +# `intervals` constructor argument or 2) via the # :py:meth:`~pynwb.file.NWBFile.add_time_intervals` or :py:meth:`~pynwb.file.NWBFile.create_time_intervals` # after the :py:class:`~pynwb.file.NWBFile` has been created. # @@ -286,9 +282,9 @@ # Adding TimeSeries references to other tables # -------------------------------------------- # -# Since :py:class:`~pynwb.base.TimeSeriesReferenceVectorData` is a regular :py:class:`~hdmf.common.table.VectoData` +# Since :py:class:`~pynwb.base.TimeSeriesReferenceVectorData` is a regular :py:class:`~hdmf.common.table.VectorData` # type, we can use it to add references to intervals in :py:class:`~pynwb.base.TimeSeries` to any -# :py:class:`~hdmf.common.table.DynamicTable`. In the :py:class:`~pynwb.icephys.IntracellularRecordingTable`, e.g., +# :py:class:`~hdmf.common.table.DynamicTable`. In the :py:class:`~pynwb.icephys.IntracellularRecordingsTable`, e.g., # it is used to reference the recording of the stimulus and response associated with a particular intracellular # electrophysiology recording. # From c97722e093333f037700e45c2603dc668a5c54f7 Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Tue, 16 Jan 2024 14:27:55 -0800 Subject: [PATCH 04/16] add nitpicky mode to make files and workflow --- .github/workflows/check_external_links.yml | 2 +- docs/Makefile | 2 +- docs/make.bat | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check_external_links.yml b/.github/workflows/check_external_links.yml index 1c709ba79..6833e959c 100644 --- a/.github/workflows/check_external_links.yml +++ b/.github/workflows/check_external_links.yml @@ -32,4 +32,4 @@ jobs: python -m pip install . - name: Check Sphinx external links - run: sphinx-build -b linkcheck ./docs/source ./test_build + run: sphinx-build -n -b linkcheck ./docs/source ./test_build diff --git a/docs/Makefile b/docs/Makefile index 80492bbf2..a579678d2 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -149,7 +149,7 @@ changes: @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: - $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + $(SPHINXBUILD) -n -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." diff --git a/docs/make.bat b/docs/make.bat index dcafe003d..95c068660 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -183,7 +183,7 @@ if "%1" == "changes" ( ) if "%1" == "linkcheck" ( - %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck + %SPHINXBUILD% -n -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck if errorlevel 1 exit /b 1 echo. echo.Link check complete; look for any errors in the above output ^ From 41f6fd7f1b8e2757350db0b1cc2fae50c6908297 Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Tue, 16 Jan 2024 14:35:03 -0800 Subject: [PATCH 05/16] fix docstring links --- docs/source/conf.py | 1 + src/pynwb/__init__.py | 19 ++++++++++++------- src/pynwb/base.py | 6 +++--- src/pynwb/file.py | 4 ++-- src/pynwb/io/utils.py | 2 +- src/pynwb/spec.py | 2 +- src/pynwb/testing/icephys_testutils.py | 4 ++-- 7 files changed, 22 insertions(+), 16 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 2ac366366..24bf40c33 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -149,6 +149,7 @@ def __call__(self, filename): 'nwbwidgets': ("https://nwb-widgets.readthedocs.io/en/latest/", None), 'nwb-overview': ("https://nwb-overview.readthedocs.io/en/latest/", None), 'zarr': ("https://zarr.readthedocs.io/en/stable/", None), + 'mpi': ('https://mpi4py.readthedocs.io/en/stable/', None) } extlinks = { diff --git a/src/pynwb/__init__.py b/src/pynwb/__init__.py index 6e3b3104f..bba472102 100644 --- a/src/pynwb/__init__.py +++ b/src/pynwb/__init__.py @@ -147,15 +147,19 @@ def _dec(cls): _dec(container_cls) -def get_nwbfile_version(h5py_file: h5py.File): +@docval({'name': 'h5py_file', 'type': h5py.File, 'doc': 'An NWB file'}, rtype=tuple, + is_method=False,=) +def get_nwbfile_version(**kwargs): """ Get the NWB version of the file if it is an NWB file. - :returns: Tuple consisting of: 1) the original version string as stored in the file and - 2) a tuple with the parsed components of the version string, consisting of integers - and strings, e.g., (2, 5, 1, beta). (None, None) will be returned if the file is not a valid NWB file - or the nwb_version is missing, e.g., in the case when no data has been written to the file yet. + + :Returns: Tuple consisting of: 1) the + original version string as stored in the file and 2) a tuple with the parsed components of the version string, + consisting of integers and strings, e.g., (2, 5, 1, beta). (None, None) will be returned if the file is not a + valid NWB file or the nwb_version is missing, e.g., in the case when no data has been written to the file yet. """ # Get the version string for the NWB file + h5py_file = getargs('h5py_file', kwargs) try: nwb_version_string = h5py_file.attrs['nwb_version'] # KeyError occurs when the file is empty (e.g., when creating a new file nothing has been written) @@ -251,7 +255,7 @@ def can_read(path: str): 'doc': 'a path to a namespace, a TypeMap, or a list consisting paths to namespaces and TypeMaps', 'default': None}, {'name': 'file', 'type': [h5py.File, 'S3File'], 'doc': 'a pre-existing h5py.File object', 'default': None}, - {'name': 'comm', 'type': "Intracomm", 'doc': 'the MPI communicator to use for parallel I/O', + {'name': 'comm', 'type': '~mpi4py.MPI.Intracomm', 'doc': 'the MPI communicator to use for parallel I/O', 'default': None}, {'name': 'driver', 'type': str, 'doc': 'driver for h5py to use when opening HDF5 file', 'default': None}, {'name': 'herd_path', 'type': str, 'doc': 'The path to the HERD', @@ -327,7 +331,8 @@ def read(self, **kwargs): {'name': 'nwbfile', 'type': 'NWBFile', 'doc': 'the NWBFile object to export. If None, then the entire contents of src_io will be exported', 'default': None}, - {'name': 'write_args', 'type': dict, 'doc': 'arguments to pass to :py:meth:`write_builder`', + {'name': 'write_args', 'type': dict, + 'doc': 'arguments to pass to :py:meth:`~hdmf.backends.io.HDMFIO.write_builder`', 'default': None}) def export(self, **kwargs): """ diff --git a/src/pynwb/base.py b/src/pynwb/base.py index d539c680a..56f909e26 100644 --- a/src/pynwb/base.py +++ b/src/pynwb/base.py @@ -514,7 +514,7 @@ class TimeSeriesReferenceVectorData(VectorData): then this indicates an invalid link (in practice both ``idx_start`` and ``count`` must always either both be positive or both be negative). When selecting data via the :py:meth:`~pynwb.base.TimeSeriesReferenceVectorData.get` or - :py:meth:`~pynwb.base.TimeSeriesReferenceVectorData.__getitem__` + :py:meth:`~object.__getitem__` functions, ``(-1, -1, TimeSeries)`` values are replaced by the corresponding :py:class:`~pynwb.base.TimeSeriesReferenceVectorData.TIME_SERIES_REFERENCE_NONE_TYPE` tuple to avoid exposing NWB storage internals to the user and simplifying the use of and checking @@ -527,11 +527,11 @@ class TimeSeriesReferenceVectorData(VectorData): TIME_SERIES_REFERENCE_TUPLE = TimeSeriesReference """Return type when calling :py:meth:`~pynwb.base.TimeSeriesReferenceVectorData.get` or - :py:meth:`~pynwb.base.TimeSeriesReferenceVectorData.__getitem__`.""" + :py:meth:`~object.__getitem__`""" TIME_SERIES_REFERENCE_NONE_TYPE = TIME_SERIES_REFERENCE_TUPLE(None, None, None) """Tuple used to represent None values when calling :py:meth:`~pynwb.base.TimeSeriesReferenceVectorData.get` or - :py:meth:`~pynwb.base.TimeSeriesReferenceVectorData.__getitem__`. See also + :py:meth:`~object.__getitem__`. See also :py:class:`~pynwb.base.TimeSeriesReferenceVectorData.TIME_SERIES_REFERENCE_TUPLE`""" @docval({'name': 'name', 'type': str, 'doc': 'the name of this VectorData', 'default': 'timeseries'}, diff --git a/src/pynwb/file.py b/src/pynwb/file.py index b473e571a..8bd7ff447 100644 --- a/src/pynwb/file.py +++ b/src/pynwb/file.py @@ -612,7 +612,7 @@ def __check_epochs(self): def add_epoch_column(self, **kwargs): """ Add a column to the epoch table. - See :py:meth:`~pynwb.core.TimeIntervals.add_column` for more details + See :py:meth:`~hdmf.common.table.DynamicTable.add_column` for more details """ self.__check_epochs() self.epoch_tags.update(kwargs.pop('tags', list())) @@ -783,7 +783,7 @@ def add_trial_column(self, **kwargs): def add_trial(self, **kwargs): """ Add a trial to the trial table. - See :py:meth:`~hdmf.common.table.DynamicTable.add_interval` for more details. + See :py:meth:`~pynwb.epoch.TimeIntervals.add_interval` for more details. Required fields are *start_time*, *stop_time*, and any columns that have been added (through calls to `add_trial_columns`). diff --git a/src/pynwb/io/utils.py b/src/pynwb/io/utils.py index 23b41b6b4..e607b9589 100644 --- a/src/pynwb/io/utils.py +++ b/src/pynwb/io/utils.py @@ -17,7 +17,7 @@ def get_nwb_version(builder: Builder, include_prerelease=False) -> Tuple[int, .. if include_prerelease=True, (2, 0, 0, "b") is returned; else, (2, 0, 0) is returned. :param builder: Any builder within an NWB file. - :type builder: Builder + :type builder: :py:class:`~hdmf.build.builders.Builder` :param include_prerelease: Whether to include prerelease information in the returned tuple. :type include_prerelease: bool :return: The version of the NWB file, as a tuple. diff --git a/src/pynwb/spec.py b/src/pynwb/spec.py index 94271118a..fe97b6eae 100644 --- a/src/pynwb/spec.py +++ b/src/pynwb/spec.py @@ -62,7 +62,7 @@ def neurodata_type_inc(self): class BaseStorageOverride: ''' This class is used for the purpose of overriding - BaseStorageSpec classmethods, without creating diamond + :py:class:`~hdmf.spec.spec.BaseStorageSpec` classmethods, without creating diamond inheritance hierarchies. ''' diff --git a/src/pynwb/testing/icephys_testutils.py b/src/pynwb/testing/icephys_testutils.py index 732f312e6..3de4619d4 100644 --- a/src/pynwb/testing/icephys_testutils.py +++ b/src/pynwb/testing/icephys_testutils.py @@ -60,10 +60,10 @@ def create_icephys_testfile(filename=None, add_custom_columns=True, randomize_da :param randomize_data: Randomize data values in the stimulus and response :type randomize_data: bool - :returns: ICEphysFile NWBFile object created for writing. NOTE: If filename is provided then + :returns: NWBFile object with icephys data created for writing. NOTE: If filename is provided then the file is written to disk, but the function does not read the file back. If you want to use the file from disk then you will need to read it with NWBHDF5IO. - :rtype: ICEphysFile + :rtype: NWBFile """ nwbfile = NWBFile( session_description='my first synthetic recording', From 1b0078c8cc7b09c68ab824982d6184114cc52b39 Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Tue, 16 Jan 2024 14:36:11 -0800 Subject: [PATCH 06/16] replace colons in docstrings for sphinx doc building --- src/pynwb/icephys.py | 26 +++++++++++++------------- src/pynwb/image.py | 2 +- src/pynwb/misc.py | 2 +- src/pynwb/ophys.py | 6 +++--- src/pynwb/retinotopy.py | 4 ++-- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/pynwb/icephys.py b/src/pynwb/icephys.py index 04382abbc..2de21d571 100644 --- a/src/pynwb/icephys.py +++ b/src/pynwb/icephys.py @@ -48,7 +48,7 @@ class IntracellularElectrode(NWBContainer): {'name': 'seal', 'type': str, 'doc': 'Information about seal used for recording.', 'default': None}, {'name': 'location', 'type': str, 'doc': 'Area, layer, comments on estimation, stereotaxis coordinates (if in vivo, etc).', 'default': None}, - {'name': 'resistance', 'type': str, 'doc': 'Electrode resistance, unit: Ohm.', 'default': None}, + {'name': 'resistance', 'type': str, 'doc': 'Electrode resistance, unit - Ohm.', 'default': None}, {'name': 'filtering', 'type': str, 'doc': 'Electrode specific filtering.', 'default': None}, {'name': 'initial_access_resistance', 'type': str, 'doc': 'Initial access resistance.', 'default': None}, {'name': 'cell_id', 'type': str, 'doc': 'Unique ID of cell.', 'default': None} @@ -164,11 +164,11 @@ class CurrentClampSeries(PatchClampSeries): 'capacitance_compensation') @docval(*get_docval(PatchClampSeries.__init__, 'name', 'data', 'electrode'), # required - {'name': 'gain', 'type': float, 'doc': 'Units: Volt/Volt'}, + {'name': 'gain', 'type': float, 'doc': 'Units - Volt/Volt'}, *get_docval(PatchClampSeries.__init__, 'stimulus_description'), - {'name': 'bias_current', 'type': float, 'doc': 'Unit: Amp', 'default': None}, - {'name': 'bridge_balance', 'type': float, 'doc': 'Unit: Ohm', 'default': None}, - {'name': 'capacitance_compensation', 'type': float, 'doc': 'Unit: Farad', 'default': None}, + {'name': 'bias_current', 'type': float, 'doc': 'Unit - Amp', 'default': None}, + {'name': 'bridge_balance', 'type': float, 'doc': 'Unit - Ohm', 'default': None}, + {'name': 'capacitance_compensation', 'type': float, 'doc': 'Unit - Farad', 'default': None}, *get_docval(PatchClampSeries.__init__, 'resolution', 'conversion', 'timestamps', 'starting_time', 'rate', 'comments', 'description', 'control', 'control_description', 'sweep_number', 'offset'), {'name': 'unit', 'type': str, 'doc': "The base unit of measurement (must be 'volts')", @@ -267,15 +267,15 @@ class VoltageClampSeries(PatchClampSeries): 'whole_cell_series_resistance_comp') @docval(*get_docval(PatchClampSeries.__init__, 'name', 'data', 'electrode'), # required - {'name': 'gain', 'type': float, 'doc': 'Units: Volt/Amp'}, # required + {'name': 'gain', 'type': float, 'doc': 'Units - Volt/Amp'}, # required *get_docval(PatchClampSeries.__init__, 'stimulus_description'), - {'name': 'capacitance_fast', 'type': float, 'doc': 'Unit: Farad', 'default': None}, - {'name': 'capacitance_slow', 'type': float, 'doc': 'Unit: Farad', 'default': None}, - {'name': 'resistance_comp_bandwidth', 'type': float, 'doc': 'Unit: Hz', 'default': None}, - {'name': 'resistance_comp_correction', 'type': float, 'doc': 'Unit: percent', 'default': None}, - {'name': 'resistance_comp_prediction', 'type': float, 'doc': 'Unit: percent', 'default': None}, - {'name': 'whole_cell_capacitance_comp', 'type': float, 'doc': 'Unit: Farad', 'default': None}, - {'name': 'whole_cell_series_resistance_comp', 'type': float, 'doc': 'Unit: Ohm', 'default': None}, + {'name': 'capacitance_fast', 'type': float, 'doc': 'Unit - Farad', 'default': None}, + {'name': 'capacitance_slow', 'type': float, 'doc': 'Unit - Farad', 'default': None}, + {'name': 'resistance_comp_bandwidth', 'type': float, 'doc': 'Unit - Hz', 'default': None}, + {'name': 'resistance_comp_correction', 'type': float, 'doc': 'Unit - percent', 'default': None}, + {'name': 'resistance_comp_prediction', 'type': float, 'doc': 'Unit - percent', 'default': None}, + {'name': 'whole_cell_capacitance_comp', 'type': float, 'doc': 'Unit - Farad', 'default': None}, + {'name': 'whole_cell_series_resistance_comp', 'type': float, 'doc': 'Unit - Ohm', 'default': None}, *get_docval(PatchClampSeries.__init__, 'resolution', 'conversion', 'timestamps', 'starting_time', 'rate', 'comments', 'description', 'control', 'control_description', 'sweep_number', 'offset'), {'name': 'unit', 'type': str, 'doc': "The base unit of measurement (must be 'amperes')", diff --git a/src/pynwb/image.py b/src/pynwb/image.py index 0295183b8..518ec8a8c 100644 --- a/src/pynwb/image.py +++ b/src/pynwb/image.py @@ -46,7 +46,7 @@ class ImageSeries(TimeSeries): 'is specified. If unit (and data) are not specified, then unit will be set to "unknown".'), 'default': None}, {'name': 'format', 'type': str, - 'doc': 'Format of image. Three types: 1) Image format; tiff, png, jpg, etc. 2) external 3) raw.', + 'doc': 'Format of image. Three types - 1) Image format; tiff, png, jpg, etc. 2) external 3) raw.', 'default': None}, {'name': 'external_file', 'type': ('array_data', 'data'), 'doc': 'Path or URL to one or more external file(s). Field only present if format=external. ' diff --git a/src/pynwb/misc.py b/src/pynwb/misc.py index 4d977b4f2..14c2e08d1 100644 --- a/src/pynwb/misc.py +++ b/src/pynwb/misc.py @@ -265,7 +265,7 @@ class DecompositionSeries(TimeSeries): 'shape': (None, None, None)}, *get_docval(TimeSeries.__init__, 'description'), {'name': 'metric', 'type': str, # required - 'doc': "metric of analysis. recommended: 'phase', 'amplitude', 'power'"}, + 'doc': "metric of analysis. recommended - 'phase', 'amplitude', 'power'"}, {'name': 'unit', 'type': str, 'doc': 'SI unit of measurement', 'default': 'no unit'}, {'name': 'bands', 'type': DynamicTable, 'doc': 'a table for describing the frequency bands that the signal was decomposed into', 'default': None}, diff --git a/src/pynwb/ophys.py b/src/pynwb/ophys.py index e3d9f8f6d..bdff47592 100644 --- a/src/pynwb/ophys.py +++ b/src/pynwb/ophys.py @@ -57,15 +57,15 @@ class ImagingPlane(NWBContainer): 'doc': 'Rate images are acquired, in Hz. If the corresponding TimeSeries is present, the rate should be ' 'stored there instead.', 'default': None}, {'name': 'manifold', 'type': 'array_data', - 'doc': ('DEPRECATED: Physical position of each pixel. size=("height", "width", "xyz"). ' + 'doc': ('DEPRECATED - Physical position of each pixel. size=("height", "width", "xyz"). ' 'Deprecated in favor of origin_coords and grid_spacing.'), 'default': None}, {'name': 'conversion', 'type': float, - 'doc': ('DEPRECATED: Multiplier to get from stored values to specified unit (e.g., 1e-3 for millimeters) ' + 'doc': ('DEPRECATED - Multiplier to get from stored values to specified unit (e.g., 1e-3 for millimeters) ' 'Deprecated in favor of origin_coords and grid_spacing.'), 'default': 1.0}, {'name': 'unit', 'type': str, - 'doc': 'DEPRECATED: Base unit that coordinates are stored in (e.g., Meters). ' + 'doc': 'DEPRECATED - Base unit that coordinates are stored in (e.g., Meters). ' 'Deprecated in favor of origin_coords_unit and grid_spacing_unit.', 'default': 'meters'}, {'name': 'reference_frame', 'type': str, diff --git a/src/pynwb/retinotopy.py b/src/pynwb/retinotopy.py index a345177c0..fd32037e8 100644 --- a/src/pynwb/retinotopy.py +++ b/src/pynwb/retinotopy.py @@ -123,9 +123,9 @@ class ImagingRetinotopy(NWBDataInterface): 'Description should be something like ["altitude", "azimuth"] or ["radius", "theta"].'}, {'name': 'focal_depth_image', 'type': FocalDepthImage, 'doc': 'Gray-scale image taken with same settings/parameters (e.g., focal depth, wavelength) ' - 'as data collection. Array format: [rows][columns].'}, + 'as data collection. Array format - [rows][columns].'}, {'name': 'vasculature_image', 'type': RetinotopyImage, - 'doc': 'Gray-scale anatomical image of cortical surface. Array structure: [rows][columns].'}, + 'doc': 'Gray-scale anatomical image of cortical surface. Array structure - [rows][columns].'}, {'name': 'name', 'type': str, 'doc': 'the name of this container', 'default': 'ImagingRetinotopy'}) def __init__(self, **kwargs): axis_1_phase_map, axis_1_power_map, axis_2_phase_map, axis_2_power_map, axis_descriptions, \ From 53895f234a27f5897839ec231ed2f5a67ecb8232 Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Tue, 16 Jan 2024 14:39:12 -0800 Subject: [PATCH 07/16] fix typo in docval inputs --- src/pynwb/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pynwb/__init__.py b/src/pynwb/__init__.py index bba472102..c1cb0f349 100644 --- a/src/pynwb/__init__.py +++ b/src/pynwb/__init__.py @@ -148,7 +148,7 @@ def _dec(cls): @docval({'name': 'h5py_file', 'type': h5py.File, 'doc': 'An NWB file'}, rtype=tuple, - is_method=False,=) + is_method=False,) def get_nwbfile_version(**kwargs): """ Get the NWB version of the file if it is an NWB file. From 4b1e3c067bc58ee90289cb15632143fab1130b1b Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Wed, 17 Jan 2024 12:03:39 -0800 Subject: [PATCH 08/16] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ddcdda7b..0549c5e16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ ### Documentation and tutorial enhancements - Add RemFile to streaming tutorial. @bendichter [#1761](https://github.com/NeurodataWithoutBorders/pynwb/pull/1761) - Fix typos and improve clarify throughout tutorials. @zm711 [#1825](https://github.com/NeurodataWithoutBorders/pynwb/pull/1825) +- Fix internal links in docstrings and tutorials. @stephprince [#1827](https://github.com/NeurodataWithoutBorders/pynwb/pull/1827) ## PyNWB 2.5.0 (August 18, 2023) From c03c9b2c6783028f31c8d9cd7578dfb13000d5af Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Thu, 18 Jan 2024 10:41:20 -0800 Subject: [PATCH 09/16] fix code blocks from italics in tutorials --- docs/gallery/domain/images.py | 6 +++--- docs/gallery/domain/ophys.py | 2 +- docs/gallery/general/plot_timeintervals.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/gallery/domain/images.py b/docs/gallery/domain/images.py index df7e36f59..58e9a8e8b 100644 --- a/docs/gallery/domain/images.py +++ b/docs/gallery/domain/images.py @@ -190,7 +190,7 @@ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # # :py:class:`~pynwb.image.RGBAImage` is for storing data of color image with transparency. -# `RGBAImage.data` must be 3D where the first and second dimensions +# ``RGBAImage.data`` must be 3D where the first and second dimensions # represent x and y. The third dimension has length 4 and represents the RGBA value. # @@ -208,7 +208,7 @@ # ^^^^^^^^^^^^^^^^^^^^^^^^^^ # # :py:class:`~pynwb.image.RGBImage` is for storing data of RGB color image. -# `RGBImage.data` must be 3D where the first and second dimensions +# ``RGBImage.data`` must be 3D where the first and second dimensions # represent x and y. The third dimension has length 3 and represents the RGB value. # @@ -224,7 +224,7 @@ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # # :py:class:`~pynwb.image.GrayscaleImage` is for storing grayscale image data. -# `GrayscaleImage.data` must be 2D where the first and second dimensions represent x and y. +# ``GrayscaleImage.data`` must be 2D where the first and second dimensions represent x and y. # gs_logo = GrayscaleImage( diff --git a/docs/gallery/domain/ophys.py b/docs/gallery/domain/ophys.py index f5058619e..277e408db 100644 --- a/docs/gallery/domain/ophys.py +++ b/docs/gallery/domain/ophys.py @@ -540,7 +540,7 @@ # Data arrays are read passively from the file. # Calling the data attribute on a :py:class:`~pynwb.base.TimeSeries` # such as a :py:class:`~pynwb.ophys.RoiResponseSeries` does not read the data -# values, but presents an `h5py` object that can be indexed to read data. +# values, but presents an ``h5py`` object that can be indexed to read data. # You can use the ``[:]`` operator to read the entire data array into memory. # Load and print all the data values of the :py:class:`~pynwb.ophys.RoiResponseSeries` # object representing the fluorescence data. diff --git a/docs/gallery/general/plot_timeintervals.py b/docs/gallery/general/plot_timeintervals.py index 69f9bf626..055914d25 100644 --- a/docs/gallery/general/plot_timeintervals.py +++ b/docs/gallery/general/plot_timeintervals.py @@ -195,7 +195,7 @@ # # To define custom, experiment-specific :py:class:`~pynwb.epoch.TimeIntervals` we can add them # either: 1) when creating the :py:class:`~pynwb.file.NWBFile` by defining the -# `intervals` constructor argument or 2) via the +# ``intervals`` constructor argument or 2) via the # :py:meth:`~pynwb.file.NWBFile.add_time_intervals` or :py:meth:`~pynwb.file.NWBFile.create_time_intervals` # after the :py:class:`~pynwb.file.NWBFile` has been created. # From d171ac16bf716804219ba398079dee07966c82ad Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Thu, 18 Jan 2024 10:45:59 -0800 Subject: [PATCH 10/16] move nitpicky configuration to conf.py file --- .github/workflows/check_external_links.yml | 2 +- docs/Makefile | 2 +- docs/make.bat | 2 +- docs/source/conf.py | 4 +++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check_external_links.yml b/.github/workflows/check_external_links.yml index 6833e959c..1c709ba79 100644 --- a/.github/workflows/check_external_links.yml +++ b/.github/workflows/check_external_links.yml @@ -32,4 +32,4 @@ jobs: python -m pip install . - name: Check Sphinx external links - run: sphinx-build -n -b linkcheck ./docs/source ./test_build + run: sphinx-build -b linkcheck ./docs/source ./test_build diff --git a/docs/Makefile b/docs/Makefile index a579678d2..80492bbf2 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -149,7 +149,7 @@ changes: @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: - $(SPHINXBUILD) -n -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." diff --git a/docs/make.bat b/docs/make.bat index 95c068660..dcafe003d 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -183,7 +183,7 @@ if "%1" == "changes" ( ) if "%1" == "linkcheck" ( - %SPHINXBUILD% -n -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck + %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck if errorlevel 1 exit /b 1 echo. echo.Link check complete; look for any errors in the above output ^ diff --git a/docs/source/conf.py b/docs/source/conf.py index 24bf40c33..3f02ef64b 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -149,7 +149,6 @@ def __call__(self, filename): 'nwbwidgets': ("https://nwb-widgets.readthedocs.io/en/latest/", None), 'nwb-overview': ("https://nwb-overview.readthedocs.io/en/latest/", None), 'zarr': ("https://zarr.readthedocs.io/en/stable/", None), - 'mpi': ('https://mpi4py.readthedocs.io/en/stable/', None) } extlinks = { @@ -163,6 +162,9 @@ def __call__(self, filename): "nwbinspector": ("https://nwbinspector.readthedocs.io/en/dev/%s", "%s"), } +nitpicky = True +nitpick_ignore = [('py:class', 'Intracomm')] + # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] From db5fc8d9106aad79a44c7746f0da14f39e8ea6d0 Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Thu, 18 Jan 2024 10:46:39 -0800 Subject: [PATCH 11/16] revert Intracomm type string --- src/pynwb/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pynwb/__init__.py b/src/pynwb/__init__.py index c1cb0f349..5e29caede 100644 --- a/src/pynwb/__init__.py +++ b/src/pynwb/__init__.py @@ -255,7 +255,7 @@ def can_read(path: str): 'doc': 'a path to a namespace, a TypeMap, or a list consisting paths to namespaces and TypeMaps', 'default': None}, {'name': 'file', 'type': [h5py.File, 'S3File'], 'doc': 'a pre-existing h5py.File object', 'default': None}, - {'name': 'comm', 'type': '~mpi4py.MPI.Intracomm', 'doc': 'the MPI communicator to use for parallel I/O', + {'name': 'comm', 'type': 'Intracomm', 'doc': 'the MPI communicator to use for parallel I/O', 'default': None}, {'name': 'driver', 'type': str, 'doc': 'driver for h5py to use when opening HDF5 file', 'default': None}, {'name': 'herd_path', 'type': str, 'doc': 'The path to the HERD', From b6143bb64a53a16adbccb426f8ee7678a2184e5f Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Thu, 18 Jan 2024 12:03:49 -0800 Subject: [PATCH 12/16] convert italics to code blocks in tutorials --- docs/gallery/general/plot_timeintervals.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/gallery/general/plot_timeintervals.py b/docs/gallery/general/plot_timeintervals.py index 055914d25..4069fd4a4 100644 --- a/docs/gallery/general/plot_timeintervals.py +++ b/docs/gallery/general/plot_timeintervals.py @@ -9,11 +9,11 @@ :py:class:`~pynwb.epoch.TimeIntervals` type. The :py:class:`~pynwb.epoch.TimeIntervals` type is a :py:class:`~hdmf.common.table.DynamicTable` with the following columns: -1. `start_time` and `stop_time` describe the start and stop times of intervals as floating point offsets in seconds +1. ``start_time`` and ``stop_time`` describe the start and stop times of intervals as floating point offsets in seconds relative to the :py:meth:`~pynwb.file.NWBFile.timestamps_reference_time` of the file. In addition, -2. `tags` is an optional, indexed column used to associate user-defined string tags with intervals (0 or more tags per +2. ``tags`` is an optional, indexed column used to associate user-defined string tags with intervals (0 or more tags per time interval) -3. `timeseries` is an optional, indexed :py:class:`~pynwb.base.TimeSeriesReferenceVectorData` column to map intervals +3. ``timeseries`` is an optional, indexed :py:class:`~pynwb.base.TimeSeriesReferenceVectorData` column to map intervals directly to ranges in select, relevant :py:class:`~pynwb.base.TimeSeries` (0 or more per time interval) 4. as a :py:class:`~hdmf.common.table.DynamicTable` user may add additional columns to :py:meth:`~pynwb.epoch.TimeIntervals` via :py:meth:`~hdmf.common.table.DynamicTable.add_column` @@ -82,8 +82,8 @@ # ^^^^^^ # # Trials can be added to an NWB file using the methods :py:meth:`~pynwb.file.NWBFile.add_trial` -# By default, NWBFile only requires trial `start_time` and `stop_time`. The `tags` and `timeseries` are optional. For -# `timeseries` we only need to supply the :py:class:`~pynwb.base.TimeSeries`. +# By default, NWBFile only requires trial ``start_time`` and ``stop_time``. The ``tags`` and ``timeseries`` are +# optional. For ``timeseries`` we only need to supply the :py:class:`~pynwb.base.TimeSeries`. # PyNWB automatically calculates the corresponding index range (described by ``idx_start`` and ``count``) for # the supplied :py:class:`~pynwb.base.TimeSeries` based on the given ``start_time`` and ``stop_time`` and # the :py:meth:`~pynwb.base.TimeSeries.timestamps` (or :py:class:`~pynwb.base.TimeSeries.starting_time` From 8e22171ba03d382def55ee2898877395a66e2bad Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Thu, 18 Jan 2024 16:40:21 -0800 Subject: [PATCH 13/16] update nitpick_ignore to include BaseStorageSpec --- docs/source/conf.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 3f02ef64b..6e766408a 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -163,7 +163,8 @@ def __call__(self, filename): } nitpicky = True -nitpick_ignore = [('py:class', 'Intracomm')] +nitpick_ignore = [('py:class', 'Intracomm'), + ('py:class', 'BaseStorageSpec')] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] From 89bcaf843bc7daa2615f43df069dbe15fd54e597 Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Thu, 18 Jan 2024 16:41:37 -0800 Subject: [PATCH 14/16] raise nitpicky warnings as errors --- .../{check_external_links.yml => check_sphinx_links.yml} | 8 ++++---- docs/Makefile | 2 +- docs/make.bat | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) rename .github/workflows/{check_external_links.yml => check_sphinx_links.yml} (82%) diff --git a/.github/workflows/check_external_links.yml b/.github/workflows/check_sphinx_links.yml similarity index 82% rename from .github/workflows/check_external_links.yml rename to .github/workflows/check_sphinx_links.yml index 1c709ba79..e1eddb97a 100644 --- a/.github/workflows/check_external_links.yml +++ b/.github/workflows/check_sphinx_links.yml @@ -1,4 +1,4 @@ -name: Check Sphinx external links +name: Check Sphinx links on: pull_request: schedule: @@ -6,7 +6,7 @@ on: workflow_dispatch: jobs: - check-external-links: + check-sphinx-links: runs-on: ubuntu-latest steps: - name: Cancel non-latest runs @@ -31,5 +31,5 @@ jobs: python -m pip install -r requirements-doc.txt python -m pip install . - - name: Check Sphinx external links - run: sphinx-build -b linkcheck ./docs/source ./test_build + - name: Check Sphinx internal and external links + run: sphinx-build -W -b linkcheck ./docs/source ./test_build diff --git a/docs/Makefile b/docs/Makefile index 80492bbf2..26960f3e7 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -149,7 +149,7 @@ changes: @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: - $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + $(SPHINXBUILD) -W -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." diff --git a/docs/make.bat b/docs/make.bat index dcafe003d..0db0fd778 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -183,7 +183,7 @@ if "%1" == "changes" ( ) if "%1" == "linkcheck" ( - %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck + %SPHINXBUILD% -W -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck if errorlevel 1 exit /b 1 echo. echo.Link check complete; look for any errors in the above output ^ From c12b9e99385bca634241026cc1f78ca8f6389491 Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Tue, 6 Feb 2024 00:54:42 -0800 Subject: [PATCH 15/16] Use hdmf 3.12.1 --- environment-ros3.yml | 2 +- requirements-min.txt | 2 +- requirements.txt | 2 +- setup.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/environment-ros3.yml b/environment-ros3.yml index c84b4c090..f5edea6ad 100644 --- a/environment-ros3.yml +++ b/environment-ros3.yml @@ -6,7 +6,7 @@ channels: dependencies: - python==3.11 - h5py==3.8.0 - - hdmf==3.5.4 + - hdmf==3.12.1 - matplotlib==3.7.1 - numpy==1.24.2 - pandas==2.0.0 diff --git a/requirements-min.txt b/requirements-min.txt index 816d53d43..098aea15d 100644 --- a/requirements-min.txt +++ b/requirements-min.txt @@ -1,6 +1,6 @@ # minimum versions of package dependencies for installing PyNWB h5py==2.10 # support for selection of datasets with list of indices added in 2.10 -hdmf==3.12.0 +hdmf==3.12.1 numpy==1.18 pandas==1.1.5 python-dateutil==2.7.3 diff --git a/requirements.txt b/requirements.txt index d09ec7425..0add9c54d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ # pinned dependencies to reproduce an entire development environment to use PyNWB h5py==3.10.0 -hdmf==3.12.0 +hdmf==3.12.1 numpy==1.26.1 pandas==2.1.2 python-dateutil==2.8.2 diff --git a/setup.py b/setup.py index 0e48c269a..d03688905 100755 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ reqs = [ 'h5py>=2.10', - 'hdmf>=3.12.0', + 'hdmf>=3.12.1', 'numpy>=1.16', 'pandas>=1.1.5', 'python-dateutil>=2.7.3', From a539e68949c247353cbd116311da63054db9f3b2 Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Wed, 7 Feb 2024 09:43:06 -0800 Subject: [PATCH 16/16] fix broken link in tutorial --- docs/gallery/advanced_io/plot_editing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/gallery/advanced_io/plot_editing.py b/docs/gallery/advanced_io/plot_editing.py index e45e3b887..a371dc588 100644 --- a/docs/gallery/advanced_io/plot_editing.py +++ b/docs/gallery/advanced_io/plot_editing.py @@ -129,7 +129,7 @@ # Editing groups # -------------- # Editing of groups is not yet supported in PyNWB. -# To edit the attributes of a group, open the file and edit it using :py:mod:`h5py`: +# To edit the attributes of a group, open the file and edit it using ``h5py``: import h5py