Skip to content

Commit

Permalink
Merge branch 'dev' into tmc
Browse files Browse the repository at this point in the history
  • Loading branch information
mavaylon1 authored May 20, 2024
2 parents 2dcc091 + 7a0d8b4 commit ba7e851
Show file tree
Hide file tree
Showing 41 changed files with 356 additions and 224 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/run_all_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ jobs:
- { name: windows-python3.12 , test-tox-env: py312 , build-tox-env: build-py312 , python-ver: "3.12", os: windows-latest }
- { name: windows-python3.12-upgraded , test-tox-env: py312-upgraded , build-tox-env: build-py312-upgraded , python-ver: "3.12", os: windows-latest }
- { name: windows-python3.12-prerelease, test-tox-env: py312-prerelease, build-tox-env: build-py312-prerelease, python-ver: "3.11", os: windows-latest }
- { name: macos-python3.8-minimum , test-tox-env: py38-minimum , build-tox-env: build-py38-minimum , python-ver: "3.8" , os: macos-latest }
- { name: macos-python3.9 , test-tox-env: py39 , build-tox-env: build-py39 , python-ver: "3.9" , os: macos-latest }
- { name: macos-python3.8-minimum , test-tox-env: py38-minimum , build-tox-env: build-py38-minimum , python-ver: "3.8" , os: macos-13 }
- { name: macos-python3.9 , test-tox-env: py39 , build-tox-env: build-py39 , python-ver: "3.9" , os: macos-13 }
- { name: macos-python3.10 , test-tox-env: py310 , build-tox-env: build-py310 , python-ver: "3.10", os: macos-latest }
- { name: macos-python3.11 , test-tox-env: py311 , build-tox-env: build-py311 , python-ver: "3.11", os: macos-latest }
- { name: macos-python3.12 , test-tox-env: py312 , build-tox-env: build-py312 , python-ver: "3.12", os: macos-latest }
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
- { name: windows-gallery-python3.8-minimum , test-tox-env: gallery-py38-minimum , python-ver: "3.8" , os: windows-latest }
- { name: windows-gallery-python3.12-upgraded , test-tox-env: gallery-py312-upgraded , python-ver: "3.12", os: windows-latest }
- { name: windows-gallery-python3.12-prerelease, test-tox-env: gallery-py312-prerelease, python-ver: "3.12", os: windows-latest }
- { name: macos-gallery-python3.8-minimum , test-tox-env: gallery-py38-minimum , python-ver: "3.8" , os: macos-latest }
- { name: macos-gallery-python3.8-minimum , test-tox-env: gallery-py38-minimum , python-ver: "3.8" , os: macos-13 }
- { name: macos-gallery-python3.12-upgraded , test-tox-env: gallery-py312-upgraded , python-ver: "3.12", os: macos-latest }
- { name: macos-gallery-python3.12-prerelease , test-tox-env: gallery-py312-prerelease, python-ver: "3.12", os: macos-latest }
steps:
Expand Down Expand Up @@ -198,7 +198,7 @@ jobs:
include:
- { name: conda-linux-python3.12-ros3 , python-ver: "3.12", os: ubuntu-latest }
- { name: conda-windows-python3.12-ros3, python-ver: "3.12", os: windows-latest }
- { name: conda-macos-python3.12-ros3 , python-ver: "3.12", os: macos-latest }
- { name: conda-macos-python3.12-ros3 , python-ver: "3.12", os: macos-13 } # This is due to DANDI not supporting osx-arm64. Will support macos-latest when this changes.
steps:
- name: Cancel non-latest runs
uses: styfle/[email protected]
Expand All @@ -224,7 +224,7 @@ jobs:
- name: Install run dependencies
run: |
pip install -r requirements-dev.txt
pip install -e .
pip install .
conda info
conda list
pip list
Expand All @@ -245,7 +245,7 @@ jobs:
include:
- { name: conda-linux-gallery-python3.12-ros3 , python-ver: "3.12", os: ubuntu-latest }
- { name: conda-windows-gallery-python3.12-ros3, python-ver: "3.12", os: windows-latest }
- { name: conda-macos-gallery-python3.12-ros3 , python-ver: "3.12", os: macos-latest }
- { name: conda-macos-gallery-python3.12-ros3 , python-ver: "3.12", os: macos-13 } # This is due to DANDI not supporting osx-arm64. Will support macos-latest when this changes.
steps:
- name: Cancel non-latest runs
uses: styfle/[email protected]
Expand All @@ -271,7 +271,7 @@ jobs:
- name: Install run dependencies
run: |
pip install matplotlib
pip install -e .
pip install .
pip list
- name: Conda reporting
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/run_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,20 @@ jobs:

- name: Install package
run: |
python -m pip install -e . # must install in editable mode for coverage to find sources
python -m pip install .
python -m pip list
- name: Run unit tests and generate coverage report
run: |
python -m coverage run test.py --pynwb
python -m coverage xml # codecov uploader requires xml format
python -m coverage report -m
python -m coverage report
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
flags: unit
files: coverage.xml
file: coverage.xml
fail_ci_if_error: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
Expand All @@ -77,13 +77,13 @@ jobs:
# validation CLI tests generate separate .coverage files that need to be merged
python -m coverage combine
python -m coverage xml # codecov uploader requires xml format
python -m coverage report -m
python -m coverage report
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
flags: integration
files: coverage.xml
file: coverage.xml
fail_ci_if_error: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/run_dandi_read_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
run: |
python -m pip install dandi fsspec requests aiohttp pytest
python -m pip uninstall -y pynwb # uninstall pynwb
python -m pip install -e .
python -m pip install .
python -m pip list
- name: Conda reporting
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/run_inspector_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ jobs:
git clone https://github.com/NeurodataWithoutBorders/nwbinspector.git
cd nwbinspector
python -m pip install -r requirements.txt pytest
# must install in editable mode for coverage to find sources
python -m pip install -e . # this might install a pinned version of pynwb instead of the current one
python -m pip install . # this might install a pinned version of pynwb instead of the current one
cd ..
python -m pip uninstall -y pynwb # uninstall the pinned version of pynwb
python -m pip install . # reinstall current branch of pynwb
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- { name: linux-python3.12-upgraded , test-tox-env: py312-upgraded , build-tox-env: build-py312-upgraded , python-ver: "3.12", os: ubuntu-latest , upload-wheels: true }
- { name: windows-python3.8-minimum , test-tox-env: py38-minimum , build-tox-env: build-py38-minimum , python-ver: "3.8" , os: windows-latest }
- { name: windows-python3.12-upgraded , test-tox-env: py312-upgraded , build-tox-env: build-py312-upgraded , python-ver: "3.12", os: windows-latest }
- { name: macos-python3.8-minimum , test-tox-env: py38-minimum , build-tox-env: build-py38-minimum , python-ver: "3.8" , os: macos-latest }
- { name: macos-python3.8-minimum , test-tox-env: py38-minimum , build-tox-env: build-py38-minimum , python-ver: "3.8" , os: macos-13 }
steps:
- name: Cancel non-latest runs
uses: styfle/[email protected]
Expand Down Expand Up @@ -200,7 +200,7 @@ jobs:
- name: Install run dependencies
run: |
pip install -r requirements-dev.txt
pip install -e .
pip install .
conda info
conda list
pip list
Expand Down Expand Up @@ -245,7 +245,7 @@ jobs:
- name: Install run dependencies
run: |
pip install matplotlib
pip install -e .
pip install .
pip list
- name: Conda reporting
Expand Down
24 changes: 17 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
# PyNWB Changelog

## PyNWB 2.7.0 (Upcoming)
## PyNWB 2.8.0 (Upcoming)

### Enhancements and minor changes
- Set rate default value inside `mock_ElectricalSeries` to avoid having to set `rate=None` explicitly when passing timestamps. @h-mayorquin [#1894](https://github.com/NeurodataWithoutBorders/pynwb/pull/1894)

## PyNWB 2.7.0 (May 2, 2024)

### Enhancements and minor changes
- Added `bounds` field to `SpatialSeries` to set optional boundary range (min, max) for each dimension of data. @mavaylon1 [#1869](https://github.com/NeurodataWithoutBorders/pynwb/pull/1869/files)
- Added support for NWB schema 2.7.0. See [2.7.0 release notes](https://nwb-schema.readthedocs.io/en/latest/format_release_notes.html) for details
- Deprecated `ImagingRetinotopy` neurodata type. @rly [#1813](https://github.com/NeurodataWithoutBorders/pynwb/pull/1813)
- Modified `OptogeneticSeries` to allow 2D data, primarily in extensions of `OptogeneticSeries`. @rly [#1812](https://github.com/NeurodataWithoutBorders/pynwb/pull/1812)
- Support `stimulus_template` as optional predefined column in `IntracellularStimuliTable`. @stephprince [#1815](https://github.com/NeurodataWithoutBorders/pynwb/pull/1815)
- Support `NWBDataInterface` and `DynamicTable` in `NWBFile.stimulus`. @rly [#1842](https://github.com/NeurodataWithoutBorders/pynwb/pull/1842)
- Deprecated `ImagingRetinotopy` neurodata type. @rly [#1813](https://github.com/NeurodataWithoutBorders/pynwb/pull/1813)
- Modified `OptogeneticSeries` to allow 2D data, primarily in extensions of `OptogeneticSeries`. @rly [#1812](https://github.com/NeurodataWithoutBorders/pynwb/pull/1812)
- Support `stimulus_template` as optional predefined column in `IntracellularStimuliTable`. @stephprince [#1815](https://github.com/NeurodataWithoutBorders/pynwb/pull/1815)
- Support `NWBDataInterface` and `DynamicTable` in `NWBFile.stimulus`. @rly [#1842](https://github.com/NeurodataWithoutBorders/pynwb/pull/1842)
- Added support for python 3.12 and upgraded dependency versions. This also includes infrastructure updates for developers. @mavaylon1 [#1853](https://github.com/NeurodataWithoutBorders/pynwb/pull/1853)
- Added `mock_Units` for generating Units tables. @h-mayorquin [#1875](https://github.com/NeurodataWithoutBorders/pynwb/pull/1875)
- Added `grid_spacing`, `grid_spacing_unit`, `origin_coords`, `origin_coords_unit` to `ImagingPlane` fields. @h-mayorquin [#1892](https://github.com/NeurodataWithoutBorders/pynwb/pull/1892)
- Added `mock_Units` for generating Units tables. @h-mayorquin [#1875](https://github.com/NeurodataWithoutBorders/pynwb/pull/1875) and [#1883](https://github.com/NeurodataWithoutBorders/pynwb/pull/1883)
- Allow datetimes without a timezone and without a time. @rly [#1886](https://github.com/NeurodataWithoutBorders/pynwb/pull/1886)
- No longer automatically set the timezone to the local timezone when not provided. [#1886](https://github.com/NeurodataWithoutBorders/pynwb/pull/1886)
- Updated testing to not install in editable mode and not run `coverage` by default. [#1897](https://github.com/NeurodataWithoutBorders/pynwb/pull/1897)

### Bug fixes
- Fix bug with reading file with linked `TimeSeriesReferenceVectorData` @rly [#1865](https://github.com/NeurodataWithoutBorders/pynwb/pull/1865)
- Fix bug where extra keyword arguments could not be passed to `NWBFile.add_{x}_column`` for use in custom `VectorData`` classes. @rly [#1861](https://github.com/NeurodataWithoutBorders/pynwb/pull/1861)
- Fix bug where extra keyword arguments could not be passed to `NWBFile.add_{x}_column` for use in custom `VectorData` classes. @rly [#1861](https://github.com/NeurodataWithoutBorders/pynwb/pull/1861)

## PyNWB 2.6.0 (February 21, 2024)

Expand Down
6 changes: 1 addition & 5 deletions docs/gallery/advanced_io/h5dataio.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,16 @@
#

from datetime import datetime

from dateutil.tz import tzlocal

from pynwb import NWBFile

start_time = datetime(2017, 4, 3, 11, tzinfo=tzlocal())
start_time = datetime(2017, 4, 3, hour=11, minute=0)

nwbfile = NWBFile(
session_description="demonstrate advanced HDF5 I/O features",
identifier="NWB123",
session_start_time=start_time,
)


####################
# Normally if we create a :py:class:`~pynwb.base.TimeSeries` we would do

Expand Down
7 changes: 2 additions & 5 deletions docs/gallery/advanced_io/linking_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,12 @@
# sphinx_gallery_thumbnail_path = 'figures/gallery_thumbnails_linking_data.png'

from datetime import datetime
from uuid import uuid4

import numpy as np
from dateutil.tz import tzlocal

from pynwb import NWBHDF5IO, NWBFile, TimeSeries
from uuid import uuid4

# Create the base data
start_time = datetime(2017, 4, 3, 11, tzinfo=tzlocal())
start_time = datetime(2017, 4, 3, hour=11, minute=0)
data = np.arange(1000).reshape((100, 10))
timestamps = np.arange(100)
filename1 = "external1_example.nwb"
Expand Down
2 changes: 1 addition & 1 deletion docs/gallery/advanced_io/parallelio.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
# from datetime import datetime
# from hdmf.backends.hdf5.h5_utils import H5DataIO
#
# start_time = datetime(2018, 4, 25, 2, 30, 3, tzinfo=tz.gettz("US/Pacific"))
# start_time = datetime(2018, 4, 25, hour=2, minute=30, second=3)
# fname = "test_parallel_pynwb.nwb"
# rank = MPI.COMM_WORLD.rank # The process ID (integer 0-3 for 4-process run)
#
Expand Down
8 changes: 2 additions & 6 deletions docs/gallery/advanced_io/plot_iterative_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,8 @@

# sphinx_gallery_thumbnail_path = 'figures/gallery_thumbnails_iterative_write.png'
from datetime import datetime
from uuid import uuid4

from dateutil.tz import tzlocal

from pynwb import NWBHDF5IO, NWBFile, TimeSeries

from uuid import uuid4

def write_test_file(filename, data, close_io=True):
"""
Expand All @@ -129,7 +125,7 @@ def write_test_file(filename, data, close_io=True):
"""

# Create a test NWBfile
start_time = datetime(2017, 4, 3, 11, tzinfo=tzlocal())
start_time = datetime(2017, 4, 3, hour=11, minute=30)
nwbfile = NWBFile(
session_description="demonstrate iterative write",
identifier=str(uuid4()),
Expand Down
21 changes: 8 additions & 13 deletions docs/gallery/domain/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,18 @@
The following examples will reference variables that may not be defined within the block they are used in. For
clarity, we define them here:
"""
# Define file paths used in the tutorial

import os

# sphinx_gallery_thumbnail_path = 'figures/gallery_thumbnails_image_data.png'
from datetime import datetime
from uuid import uuid4

import numpy as np
from dateutil import tz
from dateutil.tz import tzlocal
import os
from PIL import Image

from pynwb import NWBHDF5IO, NWBFile
from pynwb.base import Images
from pynwb.image import GrayscaleImage, ImageSeries, OpticalSeries, RGBAImage, RGBImage
from uuid import uuid4

# Define file paths used in the tutorial
nwbfile_path = os.path.abspath("images_tutorial.nwb")
moviefiles_path = [
os.path.abspath("image/file_1.tiff"),
Expand All @@ -50,12 +45,12 @@
# Create an :py:class:`~pynwb.file.NWBFile` object with the required fields
# (``session_description``, ``identifier``, ``session_start_time``) and additional metadata.

session_start_time = datetime(2018, 4, 25, 2, 30, 3, tzinfo=tz.gettz("US/Pacific"))
session_start_time = datetime(2018, 4, 25, hour=2, minute=30)

nwbfile = NWBFile(
session_description="my first synthetic recording",
identifier=str(uuid4()),
session_start_time=datetime.now(tzlocal()),
session_start_time=session_start_time,
experimenter=[
"Baggins, Bilbo",
],
Expand Down Expand Up @@ -138,21 +133,21 @@
# ^^^^^^^^^^^^^^
#
# External files (e.g. video files of the behaving animal) can be added to the :py:class:`~pynwb.file.NWBFile`
# by creating an :py:class:`~pynwb.image.ImageSeries` object using the
# by creating an :py:class:`~pynwb.image.ImageSeries` object using the
# :py:attr:`~pynwb.image.ImageSeries.external_file` attribute that specifies
# the path to the external file(s) on disk.
# The file(s) path must be relative to the path of the NWB file.
# Either ``external_file`` or ``data`` must be specified, but not both.
#
# If the sampling rate is constant, use :py:attr:`~pynwb.base.TimeSeries.rate` and
# If the sampling rate is constant, use :py:attr:`~pynwb.base.TimeSeries.rate` and
# :py:attr:`~pynwb.base.TimeSeries.starting_time` to specify time.
# For irregularly sampled recordings, use :py:attr:`~pynwb.base.TimeSeries.timestamps` to specify time for each sample
# image.
#
# Each external image may contain one or more consecutive frames of the full :py:class:`~pynwb.image.ImageSeries`.
# The :py:attr:`~pynwb.image.ImageSeries.starting_frame` attribute serves as an index to indicate which frame
# each file contains.
# For example, if the ``external_file`` dataset has three paths to files and the first and the second file have 2
# For example, if the ``external_file`` dataset has three paths to files and the first and the second file have 2
# frames, and the third file has 3 frames, then this attribute will have values `[0, 2, 4]`.

external_file = [
Expand Down
4 changes: 4 additions & 0 deletions docs/gallery/domain/plot_behavior.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,17 @@
#
# For position data ``reference_frame`` indicates the zero-position, e.g.
# the 0,0 point might be the bottom-left corner of an enclosure, as viewed from the tracking camera.
# In :py:class:`~pynwb.behavior.SpatialSeries`, the ``bounds`` field allows the user to set
# the boundary range, i.e., (min, max), for each dimension of ``data``. The units are the same as in ``data``.
# This field does not enforce a boundary on the dataset itself.

timestamps = np.linspace(0, 50) / 200

position_spatial_series = SpatialSeries(
name="SpatialSeries",
description="Position (x, y) in an open field.",
data=position_data,
bounds=[(0,50), (0,50)],
timestamps=timestamps,
reference_frame="(0,0) is bottom left corner",
)
Expand Down
4 changes: 2 additions & 2 deletions docs/gallery/general/add_remove_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
nwbfile = NWBFile(
session_description="demonstrate adding to an NWB file",
identifier="NWB123",
session_start_time=datetime.datetime.now(datetime.timezone.utc),
session_start_time=datetime.datetime.now(),
)

filename = "nwbfile.nwb"
Expand Down Expand Up @@ -91,7 +91,7 @@
nwbfile = NWBFile(
session_description="demonstrate export of an NWB file",
identifier="NWB123",
session_start_time=datetime.datetime.now(datetime.timezone.utc),
session_start_time=datetime.datetime.now(),
)
data1 = list(range(100, 200, 10))
timestamps1 = np.arange(10, dtype=float)
Expand Down
19 changes: 9 additions & 10 deletions docs/gallery/general/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,15 @@ def __init__(self, **kwargs):
# To demonstrate this, first we will make some simulated data using our extensions.

from datetime import datetime

from dateutil.tz import tzlocal

from pynwb import NWBFile
from uuid import uuid4

start_time = datetime(2017, 4, 3, 11, tzinfo=tzlocal())
create_date = datetime(2017, 4, 15, 12, tzinfo=tzlocal())
session_start_time = datetime(2017, 4, 3, hour=11, minute=0)

nwbfile = NWBFile(
"demonstrate caching", "NWB456", start_time, file_create_date=create_date
session_description="demonstrate caching",
identifier=str(uuid4()),
session_start_time=session_start_time,
)

device = nwbfile.create_device(name="trodes_rig123")
Expand Down Expand Up @@ -333,18 +332,18 @@ class PotatoSack(MultiContainerInterface):
# Then use the objects (again, this would often be done in a different file).

from datetime import datetime

from dateutil.tz import tzlocal

from pynwb import NWBHDF5IO, NWBFile

# You can add potatoes to a potato sack in different ways
potato_sack = PotatoSack(potatos=Potato(name="potato1", age=2.3, weight=3.0))
potato_sack.add_potato(Potato("potato2", 3.0, 4.0))
potato_sack.create_potato("big_potato", 10.0, 20.0)

session_start_time = datetime(2017, 4, 3, hour=12, minute=0)
nwbfile = NWBFile(
"a file with metadata", "NB123A", datetime(2018, 6, 1, tzinfo=tzlocal())
session_description="a file with metadata",
identifier=str(uuid4()),
session_start_time = session_start_time,
)

pmod = nwbfile.create_processing_module("module_name", "desc")
Expand Down
Loading

0 comments on commit ba7e851

Please sign in to comment.