Skip to content

Commit 2f2a494

Browse files
authored
Make SpatialSeries reference_frame optional (#1986)
1 parent e938202 commit 2f2a494

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
### Bug fixes
99
- Fixed bug in how `ElectrodeGroup.__init__` validates its `position` argument. @oruebel [#1770](https://github.com/NeurodataWithoutBorders/pynwb/pull/1770)
10+
- Changed `SpatialSeries.reference_frame` from required to optional as specified in the schema. @rly [#1986](https://github.com/NeurodataWithoutBorders/pynwb/pull/1986)
1011

1112
## PyNWB 2.8.2 (September 9, 2024)
1213

src/pynwb/behavior.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ class SpatialSeries(TimeSeries):
2828
'or 3 columns, which represent x, y, and z.')},
2929
{'name': 'bounds', 'type': list, 'shape': ((1, 2), (2, 2), (3, 2)), 'default': None,
3030
'doc': 'The boundary range (min, max) for each dimension of data.'},
31-
{'name': 'reference_frame', 'type': str, # required
32-
'doc': 'description defining what the zero-position is'},
31+
{'name': 'reference_frame', 'type': str,
32+
'doc': 'description defining what the zero-position is', 'default': None},
3333
{'name': 'unit', 'type': str, 'doc': 'The base unit of measurement (should be SI unit)',
3434
'default': 'meters'},
3535
*get_docval(TimeSeries.__init__, 'conversion', 'resolution', 'timestamps', 'starting_time', 'rate',

tests/integration/hdf5/test_behavior.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,14 @@ def setUpContainer(self):
1515
reference_frame='reference_frame',
1616
timestamps=[1., 2., 3.]
1717
)
18+
19+
20+
class TestSpatialSeriesMinIO(AcquisitionH5IOMixin, TestCase):
21+
22+
def setUpContainer(self):
23+
""" Return the test TimeSeries to read/write """
24+
return SpatialSeries(
25+
name='test_sS',
26+
data=np.ones((3, 2)),
27+
timestamps=[1., 2., 3.]
28+
)

tests/unit/test_behavior.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ def test_init(self):
2121
self.assertEqual(sS.bounds, [(-1,1),(-1,1),(-1,1)])
2222
self.assertEqual(sS.reference_frame, 'reference_frame')
2323

24+
def test_init_minimum(self):
25+
sS = SpatialSeries(
26+
name='test_sS',
27+
data=np.ones((3, 2)),
28+
timestamps=[1., 2., 3.]
29+
)
30+
assert sS.bounds is None
31+
assert sS.reference_frame is None
32+
2433
def test_set_unit(self):
2534
sS = SpatialSeries(
2635
name='test_sS',

0 commit comments

Comments
 (0)