diff --git a/CHANGELOG.md b/CHANGELOG.md index 16e504659..9f627141a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ### Bug fixes - Fixed bug in how `ElectrodeGroup.__init__` validates its `position` argument. @oruebel [#1770](https://github.com/NeurodataWithoutBorders/pynwb/pull/1770) +- Changed `SpatialSeries.reference_frame` from required to optional as specified in the schema. @rly [#1986](https://github.com/NeurodataWithoutBorders/pynwb/pull/1986) ## PyNWB 2.8.2 (September 9, 2024) diff --git a/src/pynwb/behavior.py b/src/pynwb/behavior.py index 1b3078535..286ec43bd 100644 --- a/src/pynwb/behavior.py +++ b/src/pynwb/behavior.py @@ -28,8 +28,8 @@ class SpatialSeries(TimeSeries): 'or 3 columns, which represent x, y, and z.')}, {'name': 'bounds', 'type': list, 'shape': ((1, 2), (2, 2), (3, 2)), 'default': None, 'doc': 'The boundary range (min, max) for each dimension of data.'}, - {'name': 'reference_frame', 'type': str, # required - 'doc': 'description defining what the zero-position is'}, + {'name': 'reference_frame', 'type': str, + 'doc': 'description defining what the zero-position is', 'default': None}, {'name': 'unit', 'type': str, 'doc': 'The base unit of measurement (should be SI unit)', 'default': 'meters'}, *get_docval(TimeSeries.__init__, 'conversion', 'resolution', 'timestamps', 'starting_time', 'rate', diff --git a/tests/integration/hdf5/test_behavior.py b/tests/integration/hdf5/test_behavior.py index d4b230bcc..eb5974449 100644 --- a/tests/integration/hdf5/test_behavior.py +++ b/tests/integration/hdf5/test_behavior.py @@ -15,3 +15,14 @@ def setUpContainer(self): reference_frame='reference_frame', timestamps=[1., 2., 3.] ) + + +class TestSpatialSeriesMinIO(AcquisitionH5IOMixin, TestCase): + + def setUpContainer(self): + """ Return the test TimeSeries to read/write """ + return SpatialSeries( + name='test_sS', + data=np.ones((3, 2)), + timestamps=[1., 2., 3.] + ) diff --git a/tests/unit/test_behavior.py b/tests/unit/test_behavior.py index 6bcf1a9eb..be43eb8b3 100644 --- a/tests/unit/test_behavior.py +++ b/tests/unit/test_behavior.py @@ -21,6 +21,15 @@ def test_init(self): self.assertEqual(sS.bounds, [(-1,1),(-1,1),(-1,1)]) self.assertEqual(sS.reference_frame, 'reference_frame') + def test_init_minimum(self): + sS = SpatialSeries( + name='test_sS', + data=np.ones((3, 2)), + timestamps=[1., 2., 3.] + ) + assert sS.bounds is None + assert sS.reference_frame is None + def test_set_unit(self): sS = SpatialSeries( name='test_sS',