Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make SpatialSeries reference_frame optional #1986

Merged
merged 2 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading