pynwb
pynwb copied to clipboard
[Bug]: v2.1.0 ElectrodeTable cols
What happened?
Just ran across this in the NWBInspector CI.
Steps to Reproduce
from pynwb.file import ElectrodeTable
table = ElectrodeTable(
name="electrodes", # default name when building through nwbfile
)
table.add_row(
x=1.0,
location="unknown",
group=ElectrodeGroup(name="test_group", description="", device=Device(name="test_device"), location="unknown"),
group_name="test_group",
)
Traceback
Traceback (most recent call last):
File "C:\Users\Raven\AppData\Local\Temp\ipykernel_18220\3595234109.py", line 6, in <cell line: 6>
table.add_row(
File "C:\Users\Raven\.conda\envs\nwbinspector\lib\site-packages\hdmf\utils.py", line 593, in func_call
return func(args[0], **pargs)
File "C:\Users\Raven\.conda\envs\nwbinspector\lib\site-packages\hdmf\common\table.py", line 595, in add_row
raise ValueError(
ValueError: row data keys don't match available columns
you supplied 1 extra keys: {'x'}
and were missing 0 keys: set()
Operating System
Windows
Python Executable
Python
Python Version
3.9
Package Versions
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
- [X] Have you checked the Contributing document?
- [X] Have you ensured this bug was not already reported?
Or is this now intended behavior, and you're supposed to add such things as columns only (not by-row?)
This is a bug and not intended behavior. I'll take a look.
As an aside, because currently ElectrodeTable
is not its own neurodata_type (yet), in PyNWB, ElectrodeTable
is not its own class and is not meant to be initialized on its own. But I can see how that is not obvious. And since we plan to make ElectrodeTable
its own class, this behavior will need to work anyway.