Skip to content

Commit 220c180

Browse files
authored
Merge pull request #1611 from NeurodataWithoutBorders/schema_2.6.0
2 parents b7cdead + 5734d0f commit 220c180

26 files changed

+508
-61
lines changed

.github/workflows/run_coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171

7272
- name: Run integration tests and generate coverage report
7373
run: |
74-
python -m coverage run -p test.py --integration
74+
python -m coverage run -p test.py --integration --backwards
7575
# validation CLI tests generate separate .coverage files that need to be merged
7676
python -m coverage combine
7777
python -m coverage xml # codecov uploader requires xml format

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# PyNWB Changelog
22

3-
## Upcoming
3+
## PyNWB 2.3.0 (February 23, 2023)
44

55
### Enhancements and minor changes
6-
- `Subject.age` can be input as a `timedelta`. @bendichter [#1590](https://github.com/NeurodataWithoutBorders/pynwb/pull/1590)
6+
- Added support for NWB Schema 2.6.0. @mavaylon1 [#1636](https://github.com/NeurodataWithoutBorders/pynwb/pull/1636)
7+
- Added a class and tests for the `OnePhotonSeries` new in NWB v2.6.0. @CodyCBakerPhD [#1593](https://github.com/NeurodataWithoutBorders/pynwb/pull/1593)(see also NWB Schema [#523](https://github.com/NeurodataWithoutBorders/nwb-schema/pull/523)
8+
- `Subject.age` can be input as a `timedelta` type. @bendichter [#1590](https://github.com/NeurodataWithoutBorders/pynwb/pull/1590)
9+
- Added `Subject.age__reference` field. @bendichter ([#1540](https://github.com/NeurodataWithoutBorders/pynwb/pull/1540))
710
- `IntracellularRecordingsTable.add_recording`: the `electrode` arg is now optional, and is automatically populated from the stimulus or response.
811
[#1597](https://github.com/NeurodataWithoutBorders/pynwb/pull/1597)
912
- Added module `pynwb.testing.mock.icephys` and corresponding tests. @bendichter
@@ -13,6 +16,7 @@
1316
- Added ``NWBHDF5IO.nwb_version`` property to get the NWB version from an NWB HDF5 file @oruebel [#1612](https://github.com/NeurodataWithoutBorders/pynwb/pull/1612)
1417
- Updated ``NWBHDF5IO.read`` to check NWB version before read and raise more informative error if an unsupported version is found @oruebel [#1612](https://github.com/NeurodataWithoutBorders/pynwb/pull/1612)
1518
- Added the `driver` keyword argument to the `pynwb.validate` function as well as the corresponding namespace caching. @CodyCBakerPhD [#1588](https://github.com/NeurodataWithoutBorders/pynwb/pull/1588)
19+
- Updated HDMF requirement to version 3.5.1. [#1611](https://github.com/NeurodataWithoutBorders/pynwb/pull/1611)
1620
- Increased the stacklevel of the warning from `_add_missing_timezone` in `pynwb.file` to make identification of which datetime field is missing a timezone easier. @CodyCBakerPhD [#1641](https://github.com/NeurodataWithoutBorders/pynwb/pull/1641)
1721

1822
### Documentation and tutorial enhancements:

Legal.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
“pynwb” Copyright (c) 2017-2022, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved.
1+
“pynwb” Copyright (c) 2017-2023, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved.
22

33
If you have questions about your rights to use or distribute this software, please contact Berkeley Lab's Innovation & Partnerships Office at [email protected].
44

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Citing NWB
112112
LICENSE
113113
=======
114114

115-
"pynwb" Copyright (c) 2017-2022, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved.
115+
"pynwb" Copyright (c) 2017-2023, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved.
116116
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
117117

118118
(1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
@@ -128,7 +128,7 @@ You are under no obligation whatsoever to provide any bug fixes, patches, or upg
128128
COPYRIGHT
129129
=========
130130

131-
"pynwb" Copyright (c) 2017-2022, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved.
131+
"pynwb" Copyright (c) 2017-2023, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved.
132132
If you have questions about your rights to use or distribute this software, please contact Berkeley Lab's Innovation & Partnerships Office at [email protected].
133133

134134
NOTICE. This Software was developed under funding from the U.S. Department of Energy and the U.S. Government consequently retains certain rights. As such, the U.S. Government has been granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide license in the Software to reproduce, distribute copies to the public, prepare derivative works, and perform publicly and display publicly, and to permit other to do so.

docs/source/conf.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,13 @@ def __call__(self, filename):
146146
'fsspec': ("https://filesystem-spec.readthedocs.io/en/latest/", None),
147147
}
148148

149-
extlinks = {'incf_lesson': ('https://training.incf.org/lesson/%s', ''),
150-
'incf_collection': ('https://training.incf.org/collection/%s', ''),
151-
'nwb_extension': ('https://github.com/nwb-extensions/%s', ''),
152-
'pynwb': ('https://github.com/NeurodataWithoutBorders/pynwb/%s', ''),
153-
'nwb_overview': ('https://nwb-overview.readthedocs.io/en/latest/%s', ''),
154-
'hdmf-docs': ('https://hdmf.readthedocs.io/en/stable/%s', ''),
155-
'dandi': ('https://www.dandiarchive.org/%s', '')}
149+
extlinks = {'incf_lesson': ('https://training.incf.org/lesson/%s', '%s'),
150+
'incf_collection': ('https://training.incf.org/collection/%s', '%s'),
151+
'nwb_extension': ('https://github.com/nwb-extensions/%s', '%s'),
152+
'pynwb': ('https://github.com/NeurodataWithoutBorders/pynwb/%s', '%s'),
153+
'nwb_overview': ('https://nwb-overview.readthedocs.io/en/latest/%s', '%s'),
154+
'hdmf-docs': ('https://hdmf.readthedocs.io/en/stable/%s', '%s'),
155+
'dandi': ('https://www.dandiarchive.org/%s', '%s')}
156156

157157
# Add any paths that contain templates here, relative to this directory.
158158
templates_path = ['_templates']
@@ -169,7 +169,7 @@ def __call__(self, filename):
169169

170170
# General information about the project.
171171
project = u'PyNWB'
172-
copyright = u'2017-2022, Neurodata Without Borders'
172+
copyright = u'2017-2023, Neurodata Without Borders'
173173

174174
# The version info for the project you're documenting, acts as replacement for
175175
# |version| and |release|, also used in various other places throughout the

license.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
“pynwb” Copyright (c) 2017-2022, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved.
1+
“pynwb” Copyright (c) 2017-2023, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved.
22

33
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
44

requirements-min.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# minimum versions of package dependencies for installing PyNWB
22
h5py==2.10 # support for selection of datasets with list of indices added in 2.10
3-
hdmf==3.4.0
3+
hdmf==3.5.1
44
numpy==1.16
55
pandas==1.1.5
66
python-dateutil==2.7.3

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# pinned dependencies to reproduce an entire development environment to use PyNWB
22
h5py==3.7.0
3-
hdmf==3.4.6
3+
hdmf==3.5.1
44
numpy==1.23.3;python_version>='3.8'
55
numpy==1.21.5;python_version<'3.8' # note that numpy 1.22 dropped python 3.7 support
66
pandas==1.5.0;python_version>='3.8'

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
reqs = [
2222
'h5py>=2.10,<4',
23-
'hdmf>=3.4.2,<4',
23+
'hdmf>=3.5.1,<4',
2424
'numpy>=1.16,<1.24',
2525
'pandas>=1.1.5,<2',
2626
'python-dateutil>=2.7.3,<3',

src/pynwb/file.py

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class Subject(NWBContainer):
5555

5656
__nwbfields__ = (
5757
'age',
58+
"age__reference",
5859
'description',
5960
'genotype',
6061
'sex',
@@ -73,8 +74,20 @@ class Subject(NWBContainer):
7374
'A timedelta will automatically be converted to The ISO 8601 Duration format.',
7475
"default": None,
7576
},
76-
{'name': 'description', 'type': str,
77-
'doc': 'A description of the subject, e.g., "mouse A10".', 'default': None},
77+
{
78+
"name": "age__reference",
79+
"type": str,
80+
"doc": "Age is with reference to this event. Can be 'birth' or 'gestational'. If reference is omitted, "
81+
"then 'birth' is implied. Value can be None when read from an NWB file with schema version "
82+
"2.0 to 2.5 where age__reference is missing.",
83+
"default": "birth",
84+
},
85+
{
86+
"name": "description",
87+
"type": str,
88+
"doc": 'A description of the subject, e.g., "mouse A10".',
89+
"default": None,
90+
},
7891
{'name': 'genotype', 'type': str,
7992
'doc': 'The genotype of the subject, e.g., "Sst-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt".',
8093
'default': None},
@@ -95,18 +108,30 @@ class Subject(NWBContainer):
95108
{'name': 'strain', 'type': str, 'doc': 'The strain of the subject, e.g., "C57BL/6J"', 'default': None},
96109
)
97110
def __init__(self, **kwargs):
98-
keys_to_set = ("age",
99-
"description",
100-
"genotype",
101-
"sex",
102-
"species",
103-
"subject_id",
104-
"weight",
105-
"date_of_birth",
106-
"strain")
111+
keys_to_set = (
112+
"age",
113+
"age__reference",
114+
"description",
115+
"genotype",
116+
"sex",
117+
"species",
118+
"subject_id",
119+
"weight",
120+
"date_of_birth",
121+
"strain",
122+
)
107123
args_to_set = popargs_to_dict(keys_to_set, kwargs)
108-
kwargs['name'] = 'subject'
109-
super().__init__(**kwargs)
124+
super().__init__(name="subject", **kwargs)
125+
126+
# NOTE when the Subject I/O mapper (see pynwb.io.file.py) reads an age__reference value of None from an
127+
# NWB 2.0-2.5 file, it sets the value to "unspecified" so that when Subject.__init__ is called, the incoming
128+
# age__reference value is NOT replaced by the default value ("birth") specified in the docval.
129+
# then we replace "unspecified" with None here. the user will never see the value "unspecified".
130+
# the ONLY way that age__reference can now be None is if it is read as None from an NWB 2.0-2.5 file.
131+
if self._in_construct_mode and args_to_set["age__reference"] == "unspecified":
132+
args_to_set["age__reference"] = None
133+
elif args_to_set["age__reference"] not in ("birth", "gestational"):
134+
raise ValueError("age__reference, if supplied, must be 'birth' or 'gestational'.")
110135

111136
weight = args_to_set['weight']
112137
if isinstance(weight, float):

0 commit comments

Comments
 (0)