From aa2cf4967bc3117678e09947c2cfb14c83a7e174 Mon Sep 17 00:00:00 2001 From: rly Date: Mon, 18 Nov 2024 15:45:56 -0800 Subject: [PATCH] Temporarily revert SpatialSeries.bounds/data__bounds --- CHANGELOG.md | 2 +- docs/gallery/domain/plot_behavior.py | 4 ---- src/pynwb/behavior.py | 9 +++------ tests/integration/hdf5/test_behavior.py | 1 - tests/unit/test_behavior.py | 3 --- 5 files changed, 4 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dfd57f722..2910a19b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ ### Enhancements and minor changes - Added support for NWB schema 2.8.0: - - Fixed support for `data__bounds` field to `SpatialSeries` to set optional boundary range (min, max) for each dimension of data. Removed `SpatialSeries.bounds` field that was not functional. @rly [#1907](https://github.com/NeurodataWithoutBorders/pynwb/pull/1907) + - Removed `SpatialSeries.bounds` field that was not functional. This will be fixed in a future release. @rly [#1907](https://github.com/NeurodataWithoutBorders/pynwb/pull/1907), ## PyNWB 2.8.3 (Upcoming) diff --git a/docs/gallery/domain/plot_behavior.py b/docs/gallery/domain/plot_behavior.py index 8d5b38d2a..8f341bea1 100644 --- a/docs/gallery/domain/plot_behavior.py +++ b/docs/gallery/domain/plot_behavior.py @@ -105,9 +105,6 @@ # # For position data ``reference_frame`` indicates the zero-position, e.g. # the 0,0 point might be the bottom-left corner of an enclosure, as viewed from the tracking camera. -# In :py:class:`~pynwb.behavior.SpatialSeries`, the ``data__bounds`` field allows the user to set -# the boundary range, i.e., (min, max), for each dimension of ``data``. The units are the same as in ``data``. -# This field does not enforce a boundary on the dataset itself. timestamps = np.linspace(0, 50) / 200 @@ -115,7 +112,6 @@ name="SpatialSeries", description="Position (x, y) in an open field.", data=position_data, - data__bounds=[(0,50), (0,50)], timestamps=timestamps, reference_frame="(0,0) is bottom left corner", ) diff --git a/src/pynwb/behavior.py b/src/pynwb/behavior.py index 7a647bc53..d4d43d515 100644 --- a/src/pynwb/behavior.py +++ b/src/pynwb/behavior.py @@ -20,14 +20,12 @@ class SpatialSeries(TimeSeries): tracking camera. The unit of data will indicate how to interpret SpatialSeries values. """ - __nwbfields__ = ('data__bounds', 'reference_frame',) + __nwbfields__ = ('reference_frame',) @docval(*get_docval(TimeSeries.__init__, 'name'), # required {'name': 'data', 'type': ('array_data', 'data', TimeSeries), 'shape': ((None, ), (None, None)), # required 'doc': ('The data values. Can be 1D or 2D. The first dimension must be time. If 2D, there can be 1, 2, ' 'or 3 columns, which represent x, y, and z.')}, - {'name': 'data__bounds', 'type': ('data', 'array_data'), '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, 'doc': 'description defining what the zero-position is', 'default': None}, {'name': 'unit', 'type': str, 'doc': 'The base unit of measurement (should be SI unit)', @@ -38,8 +36,8 @@ def __init__(self, **kwargs): """ Create a SpatialSeries TimeSeries dataset """ - name, data, data__bounds, reference_frame, unit = popargs( - 'name', 'data', 'data__bounds', 'reference_frame', 'unit', kwargs + name, data, reference_frame, unit = popargs( + 'name', 'data', 'reference_frame', 'unit', kwargs ) super().__init__(name, data, unit, **kwargs) @@ -51,7 +49,6 @@ def __init__(self, **kwargs): "The second dimension should have length <= 3 to represent at most x, y, z." % (name, str(data_shape))) - self.data__bounds = data__bounds self.reference_frame = reference_frame @staticmethod diff --git a/tests/integration/hdf5/test_behavior.py b/tests/integration/hdf5/test_behavior.py index 60c6c4324..39770876b 100644 --- a/tests/integration/hdf5/test_behavior.py +++ b/tests/integration/hdf5/test_behavior.py @@ -11,7 +11,6 @@ def setUpContainer(self): return SpatialSeries( name='test_sS', data=np.ones((3, 2)), - data__bounds=[(-1,1),(-1,1),(-1,1)], reference_frame='reference_frame', timestamps=[1., 2., 3.] ) diff --git a/tests/unit/test_behavior.py b/tests/unit/test_behavior.py index 8d5e2d4e5..37a471688 100644 --- a/tests/unit/test_behavior.py +++ b/tests/unit/test_behavior.py @@ -12,13 +12,11 @@ def test_init(self): sS = SpatialSeries( name='test_sS', data=np.ones((3, 2)), - data__bounds=[(-1,1),(-1,1),(-1,1)], reference_frame='reference_frame', timestamps=[1., 2., 3.] ) self.assertEqual(sS.name, 'test_sS') self.assertEqual(sS.unit, 'meters') - self.assertEqual(sS.data__bounds, [(-1,1),(-1,1),(-1,1)]) self.assertEqual(sS.reference_frame, 'reference_frame') def test_init_minimum(self): @@ -27,7 +25,6 @@ def test_init_minimum(self): 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):