Skip to content

[Documentation]: Remove label key in add_electrode function #2093

@timonmerk

Description

@timonmerk

What would you like changed or added to the documentation and why?

The tutorial "Extracelllular Electrophysiological Data" contains a section that references the add_electrodes function here.

        nwbfile.add_electrode(
            group=electrode_group,
            label="shank{}elec{}".format(ishank, ielec),
            location="brain area",
        )

The keyword "label" doesn't exist however. I guess this is from an old version?
I think the label keyword is actually quite useful to add exactly the info that is mentioned in the example. Is the idea here to use only the xyz localization as an identifier?

Currently though adding the label keyword results in an exception:

nwbfile.add_electrode(
group=electrode_group,
label=f"{contact_names[lead_idx]}",
location=f"{Location}_{hemisphere}",
reference="REFERENCE?"
)
Traceback (most recent call last):
File "", line 1, in
File "/Users/Timon/Documents/Houston/OCD_RCS/OCD_RCS/.venv/lib/python3.12/site-packages/hdmf/utils.py", line 578, in func_call
return func(args[0], **pargs)
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Timon/Documents/Houston/OCD_RCS/OCD_RCS/.venv/lib/python3.12/site-packages/pynwb/file.py", line 699, in add_electrode
self.electrodes.add_row(**d)
File "/Users/Timon/Documents/Houston/OCD_RCS/OCD_RCS/.venv/lib/python3.12/site-packages/hdmf/utils.py", line 578, in func_call
return func(args[0], **pargs)
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Timon/Documents/Houston/OCD_RCS/OCD_RCS/.venv/lib/python3.12/site-packages/hdmf/common/table.py", line 730, in add_row
self._add_extra_predefined_columns(data)
File "/Users/Timon/Documents/Houston/OCD_RCS/OCD_RCS/.venv/lib/python3.12/site-packages/hdmf/common/table.py", line 706, in _add_extra_predefined_columns
raise ValueError(
ValueError: row data keys don't match available columns
you supplied 1 extra keys: {'label'}

Do you have any interest in helping write or edit the documentation?

Yes, but I would need guidance.

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: lowalternative solution already working and/or relevant to only specific user(s)topic: docsissues related to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions