pynwb icon indicating copy to clipboard operation
pynwb copied to clipboard

[Bug]: v2.1.0 ElectrodeTable cols

Open CodyCBakerPhD opened this issue 1 year ago • 3 comments

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

environment_for_issue.txt

Code of Conduct

CodyCBakerPhD avatar Jul 07 '22 21:07 CodyCBakerPhD

Or is this now intended behavior, and you're supposed to add such things as columns only (not by-row?)

CodyCBakerPhD avatar Jul 07 '22 21:07 CodyCBakerPhD

This is a bug and not intended behavior. I'll take a look.

rly avatar Jul 07 '22 22:07 rly

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.

rly avatar Jul 08 '22 00:07 rly