Skip to content

Commit

Permalink
Make SpatialSeries reference_frame optional (#1986)
Browse files Browse the repository at this point in the history
  • Loading branch information
rly authored Nov 8, 2024
1 parent e938202 commit 2f2a494
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions src/pynwb/behavior.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
11 changes: 11 additions & 0 deletions tests/integration/hdf5/test_behavior.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.]
)
9 changes: 9 additions & 0 deletions tests/unit/test_behavior.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 2f2a494

Please sign in to comment.