diff --git a/src/pynwb/ecephys.py b/src/pynwb/ecephys.py index dbe1c17e3..aa13d9d54 100644 --- a/src/pynwb/ecephys.py +++ b/src/pynwb/ecephys.py @@ -3,7 +3,7 @@ from hdmf.common import DynamicTableRegion, DynamicTable, VectorData from hdmf.data_utils import DataChunkIterator, assertEqualShape -from hdmf.utils import docval, popargs, getargs, get_docval, popargs_to_dict, get_data_shape +from hdmf.utils import docval, popargs, get_docval, popargs_to_dict, get_data_shape from . import register_class, CORE_NAMESPACE from .base import TimeSeries @@ -39,22 +39,27 @@ def __init__(self, **kwargs): @register_class('ElectrodesTable', CORE_NAMESPACE) class ElectrodesTable(DynamicTable): - """TODO""" + """A table of all electrodes (i.e. channels) used for recording. Introduced in NWB 3.0.0. Replaces the "electrodes" + table (neurodata_type_inc DynamicTable, no neurodata_type_def) that is part of NWBFile.""" __columns__ = ( - {'name': 'location', 'description': 'TODO', 'required': True}, - {'name': 'group', 'description': 'TODO', 'required': True}, - {'name': 'group_name', 'description': 'TODO', 'required': False }) - - @docval({'name': 'x', 'type': VectorData, 'doc':'TODO', 'default': None}, - {'name': 'y', 'type': VectorData, 'doc':'TODO', 'default': None}, - {'name': 'z', 'type': VectorData, 'doc':'TODO', 'default': None}, - {'name': 'imp', 'type': VectorData, 'doc':'TODO', 'default': None}, - {'name': 'filtering', 'type': VectorData, 'doc':'TODO', 'default': None}, - {'name': 'rel_x', 'type': VectorData, 'doc':'TODO', 'default': None}, - {'name': 'rel_y', 'type': VectorData, 'doc':'TODO', 'default': None}, - {'name': 'rel_z', 'type': VectorData, 'doc':'TODO', 'default': None}, - {'name': 'reference', 'type': VectorData, 'doc':'TODO', 'default': None}, + {'name': 'location', 'description': 'Location of the electrode (channel).', 'required': True}, + {'name': 'group', 'description': 'Reference to the ElectrodeGroup.', 'required': True}, + {'name': 'group_name', 'description': 'Name of the ElectrodeGroup.', 'required': False }) + + @docval({'name': 'x', 'type': VectorData, 'doc':'x coordinate of the channel location in the brain', + 'default': None}, + {'name': 'y', 'type': VectorData, 'doc':'y coordinate of the channel location in the brain', + 'default': None}, + {'name': 'z', 'type': VectorData, 'doc':'z coordinate of the channel location in the brain', + 'default': None}, + {'name': 'imp', 'type': VectorData, 'doc':'Impedance of the channel, in ohms.', 'default': None}, + {'name': 'filtering', 'type': VectorData, 'doc':'Description of hardware filtering.', 'default': None}, + {'name': 'rel_x', 'type': VectorData, 'doc':'x coordinate in electrode group', 'default': None}, + {'name': 'rel_y', 'type': VectorData, 'doc':'xy coordinate in electrode group', 'default': None}, + {'name': 'rel_z', 'type': VectorData, 'doc':'z coordinate in electrode group', 'default': None}, + {'name': 'reference', 'type': VectorData, 'default': None, + 'doc':'Description of the reference electrode and/or reference scheme used for this electrode'}, *get_docval(DynamicTable.__init__, 'id', 'columns', 'colnames')) def __init__(self, **kwargs): kwargs['name'] = 'electrodes' @@ -79,7 +84,7 @@ def __init__(self, **kwargs): def copy(self): """ - Return a copy of this DynamicTable. + Return a copy of this ElectrodesTable. This is useful for linking. """ kwargs = dict(id=self.id, columns=self.columns, colnames=self.colnames) diff --git a/src/pynwb/nwb-schema b/src/pynwb/nwb-schema index 65230a20d..78df82c4b 160000 --- a/src/pynwb/nwb-schema +++ b/src/pynwb/nwb-schema @@ -1 +1 @@ -Subproject commit 65230a20d9f6f895968c61f1cc52b2c15fcec10b +Subproject commit 78df82c4bdc6f094a6dfb97fb85d9ae396087d91 diff --git a/tests/unit/foo.py b/tests/unit/foo.py deleted file mode 100644 index 16f25db94..000000000 --- a/tests/unit/foo.py +++ /dev/null @@ -1,69 +0,0 @@ -from datetime import datetime -from uuid import uuid4 - -import numpy as np -from dateutil.tz import tzlocal -from hdmf.common import VectorData - -from pynwb import NWBHDF5IO, NWBFile -from pynwb.ecephys import LFP, ElectricalSeries, ElectrodeGroup, ElectrodesTable - -nwbfile = NWBFile( - session_description="my first synthetic recording", - identifier=str(uuid4()), - session_start_time=datetime.now(tzlocal()), - experimenter=[ - "Baggins, Bilbo", - ], - lab="Bag End Laboratory", - institution="University of Middle Earth at the Shire", - experiment_description="I went on an adventure to reclaim vast treasures.", - session_id="LONELYMTN001", -) - -device = nwbfile.create_device( - name="array", description="the best array", manufacturer="Probe Company 9000" -) - -group = ElectrodeGroup( name='foo', - description="electrode group", - device=device, - location="brain area",) -# location_col = VectorData(name='location', description='foo', data=['brain area']) -# group_col = VectorData(name='groups', description='foo', data=[group]) - -table = ElectrodesTable() -nwbfile.electrodes = table -nwbfile.add_electrode_group(group) -nwbfile.add_electrode(group=group, location='brain') -# breakpoint() -# nwbfile.add_electrode_column(name="label", description="label of electrode") - -# nshanks = 4 -# nchannels_per_shank = 3 -# electrode_counter = 0 -# # -# for ishank in range(nshanks): -# # create an electrode group for this shank -# electrode_group = nwbfile.create_electrode_group( -# name="shank{}".format(ishank), -# description="electrode group for shank {}".format(ishank), -# device=device, -# location="brain area", -# ) -# # add electrodes to the electrode table -# for ielec in range(nchannels_per_shank): -# nwbfile.add_electrode( -# group=electrode_group, -# label="shank{}elec{}".format(ishank, ielec), -# location="brain area", -# ) -# electrode_counter += 1 -# breakpoint() -# with NWBHDF5IO("ecephys_tutorial.nwb", "w") as io: -# io.write(nwbfile) -# new='/Users/mavaylon/Research/NWB/pynwb/ecephys_tutorial.nwb' -io= NWBHDF5IO("/Users/mavaylon/Research/NWB/pynwb/tests/back_compat/2.6.0_DynamicTableElectrodes.nwb", "r") -# io= NWBHDF5IO(new, 'r') -read_nwbfile = io.read() -breakpoint()