Skip to content

Commit

Permalink
Make contact required, minor other fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rly committed Jul 12, 2024
1 parent 4369cdc commit 80dd349
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ classDiagram
columns
--------------------------------------
id : VectorData[int]
contact : DynamicTableRegion, optional
contact : DynamicTableRegion
--> target : ContactsTable
reference_contact : DynamicTableRegion, optional
--> target : ContactsTable
Expand Down
2 changes: 1 addition & 1 deletion spec/ndx-extracellular-channels.extensions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ groups:
neurodata_type_inc: VectorData
dtype: text
doc: Shape of the contact; e.g. 'circle'
quantity: '?'
- name: radius_in_um
neurodata_type_inc: VectorData
dtype: float
Expand Down Expand Up @@ -221,7 +222,6 @@ groups:
- name: contact
neurodata_type_inc: DynamicTableRegion
doc: The row in a ContactsTable that represents the contact used as a channel.
quantity: '?'
- name: reference_contact
neurodata_type_inc: DynamicTableRegion
doc: The row in a ContactsTable that represents the contact used as a reference.
Expand Down
11 changes: 11 additions & 0 deletions src/pynwb/ndx_extracellular_channels/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,16 @@

from .io import from_probeinterface, to_probeinterface

__all__ = (
"ProbeInsertion",
"ContactsTable",
"ProbeModel",
"Probe",
"ChannelsTable",
"ExtracellularSeries",
"from_probeinterface",
"to_probeinterface",
)

# Remove these functions from the package
del load_namespaces, get_class
26 changes: 18 additions & 8 deletions src/pynwb/tests/test_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,12 +457,16 @@ def test_constructor_add_row_minimal(self):
ct = ChannelsTable(
description="Test channels table",
probe=probe,
target_tables={
"contact": probe.probe_model.contacts_table,
},
)
ct.add_row()
ct.add_row()
ct.add_row(contact=0)
ct.add_row(contact=1)

assert len(ct) == 2
assert ct.id.data == [0, 1]
assert ct["contact"].data == [0, 1]

def test_constructor_add_row(self):
"""Test that the constructor for ChannelsTable sets values as expected."""
Expand Down Expand Up @@ -611,10 +615,13 @@ def test_constructor(self):
name="Neuropixels1ChannelsTable",
description="Test channels table",
probe=probe,
target_tables={
"contact": probe.probe_model.contacts_table,
},
)
ct.add_row()
ct.add_row()
ct.add_row()
ct.add_row(contact=0)
ct.add_row(contact=1)
ct.add_row(contact=2)

channels = DynamicTableRegion(
name="channels", # NOTE: this must be named "channels" when used in ExtracellularSeries
Expand Down Expand Up @@ -661,10 +668,13 @@ def addContainer(self):
name="Neuropixels1ChannelsTable",
description="Test channels table",
probe=probe,
target_tables={
"contact": probe.probe_model.contacts_table,
},
)
ct.add_row()
ct.add_row()
ct.add_row()
ct.add_row(contact=0)
ct.add_row(contact=1)
ct.add_row(contact=2)

# put this in nwbfile.acquisition for testing
self.nwbfile.add_acquisition(ct)
Expand Down
4 changes: 2 additions & 2 deletions src/spec/create_extension_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def main():
"(first element), which direction is positive in the y direction (second element), etc."
),
dtype="text",
required=False, # TODO should this be required?
required=False,
)
],
),
Expand Down Expand Up @@ -108,6 +108,7 @@ def main():
neurodata_type_inc="VectorData",
doc="Shape of the contact; e.g. 'circle'",
dtype="text",
quantity="?",
),
NWBDatasetSpec(
name="radius_in_um",
Expand Down Expand Up @@ -315,7 +316,6 @@ def main():
name="contact",
neurodata_type_inc="DynamicTableRegion",
doc="The row in a ContactsTable that represents the contact used as a channel.",
quantity="?", # TODO should this be optional?
),
NWBDatasetSpec(
name="reference_contact",
Expand Down

0 comments on commit 80dd349

Please sign in to comment.