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

[Feature]: Automatically add linked objects to an NWBFile if we know where they should go. #1717

Open
3 tasks done
mavaylon1 opened this issue Jul 9, 2023 · 2 comments
Open
3 tasks done
Assignees
Labels
category: enhancement improvements of code or code behavior priority: medium non-critical problem and/or affecting only a small set of NWB users

Comments

@mavaylon1
Copy link
Collaborator

What would you like to see added to PyNWB?

This came up in #1701. The goal is to auto-add the ElectrodesTable to the nwbfile when the ElectricalSeries is added. This could be done for other objects, but we will start with this application first.

Is your feature request related to a problem?

No response

What solution would you like?

Auto-Add the table.

Do you have any interest in helping implement the feature?

Yes.

Code of Conduct

@mavaylon1 mavaylon1 self-assigned this Jul 9, 2023
@mavaylon1 mavaylon1 added category: enhancement improvements of code or code behavior priority: medium non-critical problem and/or affecting only a small set of NWB users labels Jul 9, 2023
@mavaylon1
Copy link
Collaborator Author

mavaylon1 commented Jul 9, 2023

@rly I am trying to think how this would work. The meat and potatoes of add_acquisition is generated as an add method. When adding ElectricalSeries to the NWBFile, the parent is set. The first thing I think of is modifying add_acquisition to check if the instance is ElectricalSeries and then auto add the table via a child hierarchy search. I'll explore and test.

Edit: I suppose we could modify it as such:

    @docval({'name': 'nwbdata', 'type': (NWBDataInterface, DynamicTable)},
            {'name': 'use_sweep_table', 'type': bool, 'default': False, 'doc': 'Use the deprecated SweepTable'})
    def add_acquisition(self, **kwargs):
        nwbdata = popargs('nwbdata', kwargs)
        self._add_acquisition_internal(nwbdata)
        if isinstance(nwbdata, ElectricalSeries):
            self.set_electrode_table(nwbdata.electrodes.table)
        use_sweep_table = popargs('use_sweep_table', kwargs)
        if use_sweep_table:
            self._update_sweep_table(nwbdata)

@mavaylon1
Copy link
Collaborator Author

@rly can we find a time before Boston to review this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: enhancement improvements of code or code behavior priority: medium non-critical problem and/or affecting only a small set of NWB users
Projects
None yet
Development

No branches or pull requests

1 participant