Skip to content

Commit

Permalink
add cell_id to IntracellularElectrode (#1459)
Browse files Browse the repository at this point in the history
* add cell_id to constructor and adjust tests accordingly

* add cell_id to rountrip test for IntracellularElectrode

* update submodule

Co-authored-by: Ryan Ly <[email protected]>
  • Loading branch information
bendichter and rly authored May 1, 2022
1 parent c1e6fa1 commit 2973aeb
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 15 deletions.
9 changes: 6 additions & 3 deletions src/pynwb/icephys.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class IntracellularElectrode(NWBContainer):
'''
'''

__nwbfields__ = ('slice',
__nwbfields__ = ('cell_id',
'slice',
'seal',
'description',
'location',
Expand All @@ -51,11 +52,12 @@ class IntracellularElectrode(NWBContainer):
{'name': 'resistance', 'type': str, 'doc': 'Electrode resistance COMMENT: unit: Ohm.', 'default': None},
{'name': 'filtering', 'type': str, 'doc': 'Electrode specific filtering.', 'default': None},
{'name': 'initial_access_resistance', 'type': str, 'doc': 'Initial access resistance.', 'default': None},
{'name': 'cell_id', 'type': str, 'doc': 'Unique ID of cell.', 'default': None}
)
def __init__(self, **kwargs):
slice, seal, description, location, resistance, filtering, initial_access_resistance, device = popargs(
slice, seal, description, location, resistance, filtering, initial_access_resistance, device, cell_id = popargs(
'slice', 'seal', 'description', 'location', 'resistance',
'filtering', 'initial_access_resistance', 'device', kwargs)
'filtering', 'initial_access_resistance', 'device', 'cell_id', kwargs)
call_docval_func(super().__init__, kwargs)
self.slice = slice
self.seal = seal
Expand All @@ -65,6 +67,7 @@ def __init__(self, **kwargs):
self.filtering = filtering
self.initial_access_resistance = initial_access_resistance
self.device = device
self.cell_id = cell_id


@register_class('PatchClampSeries', CORE_NAMESPACE)
Expand Down
21 changes: 12 additions & 9 deletions tests/integration/hdf5/test_icephys.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@ class TestIntracellularElectrode(NWBH5IOMixin, TestCase):
def setUpContainer(self):
""" Return the test IntracellularElectrode to read/write """
self.device = Device(name='device_name')
elec = IntracellularElectrode(name="elec0",
slice='tissue slice',
resistance='something measured in ohms',
seal='sealing method',
description='a fake electrode object',
location='Springfield Elementary School',
filtering='a meaningless free-form text field',
initial_access_resistance='I guess this changes',
device=self.device)
elec = IntracellularElectrode(
name="elec0",
slice='tissue slice',
resistance='something measured in ohms',
seal='sealing method',
description='a fake electrode object',
location='Springfield Elementary School',
filtering='a meaningless free-form text field',
initial_access_resistance='I guess this changes',
device=self.device,
cell_id="this_cell",
)
return elec

def addContainer(self, nwbfile):
Expand Down
8 changes: 6 additions & 2 deletions tests/unit/test_icephys.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ def GetElectrode():
location='location',
resistance='resistance',
filtering='filtering',
initial_access_resistance='initial_access_resistance')
initial_access_resistance='initial_access_resistance',
cell_id='this_cell',
)
return elec


Expand Down Expand Up @@ -118,7 +120,8 @@ def test_constructor(self):
'location',
'resistance',
'filtering',
'initial_access_resistance')
'initial_access_resistance',
'this_cell')
self.assertEqual(elec.name, 'test_iS')
self.assertEqual(elec.device, device)
self.assertEqual(elec.description, 'description')
Expand All @@ -128,6 +131,7 @@ def test_constructor(self):
self.assertEqual(elec.resistance, 'resistance')
self.assertEqual(elec.filtering, 'filtering')
self.assertEqual(elec.initial_access_resistance, 'initial_access_resistance')
self.assertEqual(elec.cell_id, 'this_cell')


class PatchClampSeriesConstructor(TestCase):
Expand Down

0 comments on commit 2973aeb

Please sign in to comment.