Skip to content

What should be default name of pynwb.misc.Units? #1882

@h-mayorquin

Description

@h-mayorquin

Right now the following throws an error:

from pynwb.misc import Units
from pynwb.testing.mock.file import mock_NWBFile


nwbfile = mock_NWBFile()
nwbfile.units = Units()


ValueError: Field 'units' on NWBFile must be named 'units'."

Units default name is "Units" as supported by best practices for naming conventions:

assert Units().name == "Units"

And is defined here:

pynwb/src/pynwb/misc.py

Lines 157 to 158 in 2259bed

@docval({'name': 'name', 'type': str, 'doc': 'Name of this Units interface', 'default': 'Units'},
*get_docval(DynamicTable.__init__, 'id', 'columns', 'colnames'),

However, the NWBFile has "units" as a required name for the attribute here on its fields:

pynwb/src/pynwb/file.py

Lines 272 to 273 in 2259bed

{'name': 'units', 'child': True, 'required_name': 'units'},
{'name': 'subject', 'child': True, 'required_name': 'subject'},

So I think that one of the two should give? Which one makes more sense? Maybe the nwbfile.units should accept "Units" as the name? Should it be the other way around?

Metadata

Metadata

Assignees

Labels

category: bugerrors in the code or code behaviorpriority: lowalternative solution already working and/or relevant to only specific user(s)topic: testingissues related to testing

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions