Open CodyCBakerPhD opened 1 year ago
Thanks @CodyCBakerPhD for the detailed background and proposal.
I agree that the current best practice is not ideal, and I like your proposed long-term solution.
To contrast, here is another possible solution:
Create a new type AuxiliaryElectricalSeries
that has the same fields as ElectricalSeries
and links to an AuxiliaryElectrodeTable
which does not contain neural-related fields. Perhaps this AuxiliaryElectrodeTable
can have a column for an AuxiliaryElectrodeGroup
which also does not contain neural-related fields.
I think the type inheritance model that you proposed is probably better and cleaner.
The Best Practice in question: https://nwbinspector.readthedocs.io/en/dev/best_practices/time_series.html#subtypes sates
I would like to open a discussion @oruebel @rly @bendichter about relaxing this as a Best Practice.
The main reasoning for this practice is because an
ElectricalSeries
must link toelectrodes
and the current electrodes table has many required fields (and many more optional fields) that reflect neurophysiological properties, such as brain areas, probe geometry, and so on. Thus for analog, digital, environmental, or other auxiliary types of electrodes, such columns would be completely inapplicable and so they don't 'belong' on the main electrodes table and hence should not be written usingElectricalSeries
.However, as
ecephys
systems have been increasingly developed to contain non-neural channel activity, we've seen many cases where users, and indeed fellow devs, are motivated to use theElectricalSeries
type to write data from channels that are recording only secondary (non-neurophysiological) data.This best practice is not obvious upon first glance why it should prohibit the use of this neurodata type, since the data we want to represent is stored in Volts, and has metadata structure nearly identical to the
Device
/ElectrodeGroup
/Electrodes
hierarchy established by theElectricalSeries
. In fact, for many recording systems, the data and metadata for those channels are stored side-by-side and nearly indistinguishable from the neurophysiological ones.If we follow the best practice, we lose a lot of rich metadata linkage between the acquisition device, channel/group relations, and even non-neural electrode channel metadata because the resulting
TimeSeries
cannot link to any of these. As such I'd like to propose a couple of solutions that work around the reasoning for the Best Practice, and would result in repealing or adjusting it as a practice going into the future.Proposed interim solution:
This workflow ought to be possible currently since I don't think
ElectricalSeries
checks if theDynamicTableRegion
of theelectrodes
field points to an actual electrodes table...DynamicTable
that mimics much of the structure of the usual electrodes table but foregoes the neurophysiogical columns. This is added toacquisition
.ElectricalSeries
for the non-neural electrode data and link them to the customDynamicTable
Proposed long-term solution:
BaseElectrodeTable
neurodata type that defines the minimal columns for all types of electrodes.NeurophysiologyElectrodeTable
, or any other name that distinguishes it from non-neural electrodes. Note that all currentnwbfile
level references can still exist (such asnwbfile.electrodes
,nwbfile.add_electrode
, etc.) without breaking any back-compatibility.AuxiliaryElectrodeTable
which does not contain those neural-related fields.ElectricalSeries.electrodes
table regions may point to either this table or the neurophysiologic one - all that matter is theDynamicTableRegion
points to some child of theBaseElectrodeTable
.