NeurodataWithoutBorders / pynwb

A Python API for working with Neurodata stored in the NWB Format
https://pynwb.readthedocs.io
Other
178 stars 84 forks source link

Add device entry for each data acquisition object #1250

Open lfrank opened 4 years ago

lfrank commented 4 years ago

Many experiments involve collecting data from multiple sources simultaneously. In our case we have both the main data acquisition system and cameras which produce separate data streams. It would be helpful for data objects (e-series, imageseries, etc.) to have an optional Device field that would allow specification of the Device that was used. As new extensions that provide useful information about the devices themselves are developed, this link would help people understand more about the origin of the data.

bendichter commented 4 years ago

Hi @lfrank, sorry for the delay. Yes, it's definitely important to associate TimeSeries objects with the Devices that recorded them. For ElectricalSeries, this referencing can be done via ElectricalSeries.electrodes -> reference electrodes table -> each row is associated with an ElectrodeGroup -> references a Device. You have something similar with TwoPhotonSeries. Do you think this type of thing would be sufficient for you, or would you need a direct link to Device? In some cases, like with a behavioral video, we do not currently have an ability to link to the camera as a device, so maybe that should be added.

rly commented 4 years ago

Hi @lfrank, as @bendichter mentioned above, many different acquisition data types already have Device objects associated with them, though the association is currently indirect. We can add a function for ElectricalSeries in PyNWB that returns a list of devices associated with each electrode, and similarly for RoiResponseSeries. Would this suit your needs?

rly commented 4 years ago

@lfrank I see that a generic ImageSeries does not have a way to link to a Device and that the novela extension added this. I created a PR in https://github.com/NeurodataWithoutBorders/nwb-schema/pull/454 to fix this in the core NWB.

lfrank commented 4 years ago

@rly @bendichter Thanks to both of you, and I was mostly thinking of the image series, which, as you noted, didn't have a way to link to a device. I should add, though, that in a perfect world one could link back to a list of devices. We've used the electrode_group device to refer to the probe that was used, but of course the headstage and data acquisition system that are also critical to actually collect the data and there's currently no way that I know of to capture those multi-device dependences.