Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: nwbfile.add_trial_column does not allow extra kwargs #1860

Closed
3 tasks done
rly opened this issue Mar 14, 2024 · 3 comments · Fixed by #1861
Closed
3 tasks done

[Bug]: nwbfile.add_trial_column does not allow extra kwargs #1860

rly opened this issue Mar 14, 2024 · 3 comments · Fixed by #1861
Assignees
Labels
category: bug errors in the code or code behavior priority: low alternative solution already working and/or relevant to only specific user(s)

Comments

@rly
Copy link
Contributor

rly commented Mar 14, 2024

What happened?

NWBFile.add_trial_column is a shortcut for nwbfile.trials.add_column. nwbfile.trials.add_column allows extra keyword args to be passed, which are then passed to the constructor of col_cls. This is useful when the custom VectorData subclass has additional arguments. NWBFile.add_trial_column does not allow extra keyword args to be passed, so certain custom VectorData subclasses cannot be initialized.

Steps to Reproduce

nwbfile.add_trial_column(name="HED", hed_version="8.2.0", description="temp", col_cls=HedTags, data=[])

Traceback

TypeError: NWBFile.add_trial_column: unrecognized argument: 'hed_version'

Operating System

macOS

Python Executable

Conda

Python Version

lower version (unsupported)

Package Versions

No response

Code of Conduct

@rly
Copy link
Contributor Author

rly commented Mar 14, 2024

This affects not just add_trial_column but all convenience add_column methods in NWBFile:

  • add_epoch_column
  • add_electrode_column
  • add_unit_column
  • add_trial_column
  • add_invalid_times_column

@rly rly self-assigned this Mar 14, 2024
@rly rly added category: bug errors in the code or code behavior priority: low alternative solution already working and/or relevant to only specific user(s) labels Mar 14, 2024
@VisLab
Copy link

VisLab commented Mar 22, 2024

I was curious as to why the add_column wasn't a method of DynamicTable and the ability to add fields housed there. Thx.

@oruebel
Copy link
Contributor

oruebel commented Mar 22, 2024

I was curious as to why the add_column wasn't a method of DynamicTable and the ability to add fields housed there

As @rly mentioned in the issue, the NWBFile.add_trial_column and others are convenience methods that under the hood add the column to the appropriate table, e.g., nwbfile.trials.add_column. I.e., add_column indeed lives on DynamicTable. It's a matter of allowing the additional arguments to be passed.

@rly rly closed this as completed in #1861 Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: bug errors in the code or code behavior priority: low alternative solution already working and/or relevant to only specific user(s)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants