NeurodataWithoutBorders/pynwb

[Bug]: Cannot add "bounds" attribute to SpatialSeries/data

Opened this issue · 1 comments

rly commented

What happened?

In NeurodataWithoutBorders/nwb-schema#567 (pending NWB schema 2.8.0), we added a new optional "bounds" field to "SpatialSeries/data". It turns out that the current version of PyNWB / HDMF does not support writing (and probably also validating) additional attributes to untyped datasets like "data". I am surprised that we have not encountered this before.

This line in HDMF's ObjectMapper https://github.com/hdmf-dev/hdmf/blob/26d584cc0a3e0985d0e053ab9eeaf5bf8849cd31/src/hdmf/build/objectmapper.py#L1107
does not add new attributes from the new spec.

The issue appears to be due to resolution of the spec. I will open a ticket in HDMF.

While we resolve this in HDMF, I propose we revert the addition of "bounds" to "SpatialSeries/data" to unblock the other schema/pynwb issues.

Steps to Reproduce

import numpy as np

from pynwb.behavior import SpatialSeries
from pynwb.testing import AcquisitionH5IOMixin, TestCase


class TestSpatialSeriesIO(AcquisitionH5IOMixin, TestCase):

    def setUpContainer(self):
        """ Return the test TimeSeries to read/write """
        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.]
        )

Traceback

# data__bounds is not written

Operating System

macOS

Python Executable

Conda

Python Version

3.11

Package Versions

No response

Code of Conduct

I think reverting the addition of "bounds" to "SpatialSeries/data" makes sense until we can resolve this issue in HDMF and support writing additional attributes for untyped datasets.