Skip to content

Commit

Permalink
Add back ProbeModel.model, remove 1D contour case
Browse files Browse the repository at this point in the history
  • Loading branch information
rly committed Jun 4, 2024
1 parent 8366145 commit bf90877
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
7 changes: 3 additions & 4 deletions spec/ndx-extracellular-channels.extensions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,17 @@ groups:
default_value: 2
doc: dimension of the probe
required: false
- name: model
dtype: text
doc: Name of the model of the probe, e.g., 'Neuropixels 1.0'.
- name: planar_contour_in_um
dtype: float
dims:
- - num_points
- x
- - num_points
- x, y
- - num_points
- x, y, z
shape:
- - null
- 1
- - null
- 2
- - null
Expand Down
1 change: 1 addition & 0 deletions src/pynwb/ndx_extracellular_channels/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ def _single_probe_to_ndx_probe(
probe_model = ndx_extracellular_channels.ProbeModel(
name=model_name,
manufacturer=probe.manufacturer,
model=model_name,
ndim=probe.ndim,
planar_contour_in_um=probe.probe_planar_contour * conversion_factor,
contacts_table=contacts_table,
Expand Down
6 changes: 6 additions & 0 deletions src/pynwb/tests/test_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ def test_constructor(self):
pm = ProbeModel(
name="Neuropixels 1.0",
description="A neuropixels probe",
model="Neuropixels 1.0",
manufacturer="IMEC",
# TODO make planar_contour_in_um optional
planar_contour_in_um=[[-10.0, -10.0], [10.0, -10.0], [10.0, 10.0], [-10.0, 10.0]],
Expand Down Expand Up @@ -169,6 +170,7 @@ def addContainer(self):
pm = ProbeModel(
name="Neuropixels 1.0",
description="A neuropixels probe",
model="Neuropixels 1.0",
manufacturer="IMEC",
planar_contour_in_um=[[-10.0, -10.0], [10.0, -10.0], [10.0, 10.0], [-10.0, 10.0]],
contacts_table=ct,
Expand Down Expand Up @@ -197,6 +199,7 @@ def test_constructor_minimal(self):
pm = ProbeModel(
name="Neuropixels 1.0",
description="A neuropixels probe",
model="Neuropixels 1.0",
manufacturer="IMEC",
planar_contour_in_um=[[-10.0, -10.0], [10.0, -10.0], [10.0, 10.0], [-10.0, 10.0]],
contacts_table=ct,
Expand Down Expand Up @@ -224,6 +227,7 @@ def test_constructor(self):
pm = ProbeModel(
name="Neuropixels 1.0",
description="A neuropixels probe",
model="Neuropixels 1.0",
manufacturer="IMEC",
planar_contour_in_um=[[-10.0, -10.0], [10.0, -10.0], [10.0, 10.0], [-10.0, 10.0]],
contacts_table=ct,
Expand Down Expand Up @@ -256,6 +260,7 @@ def addContainer(self):
pm = ProbeModel(
name="Neuropixels 1.0",
description="A neuropixels probe",
model="Neuropixels 1.0",
manufacturer="IMEC",
planar_contour_in_um=[[-10.0, -10.0], [10.0, -10.0], [10.0, 10.0], [-10.0, 10.0]],
contacts_table=ct,
Expand Down Expand Up @@ -297,6 +302,7 @@ def _create_test_probe():
pm = ProbeModel(
name="Neuropixels 1.0",
description="A neuropixels probe",
model="Neuropixels 1.0",
manufacturer="IMEC",
planar_contour_in_um=[[-10.0, -10.0], [10.0, -10.0], [10.0, 10.0], [-10.0, 10.0]],
contacts_table=ct,
Expand Down
1 change: 1 addition & 0 deletions src/pynwb/tests/test_example_usage_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
pm = ProbeModel(
name="Neuropixels 1.0",
description="A neuropixels probe",
model="neuropixels 1.0",
manufacturer="IMEC",
planar_contour_in_um=[[-10.0, -10.0], [10.0, -10.0], [10.0, 10.0], [-10.0, 10.0]],
contacts_table=contacts_table,
Expand Down
12 changes: 10 additions & 2 deletions src/spec/create_extension_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,14 @@ def main():
attributes=[
# inherits name, description, manufacturer from Device
NWBAttributeSpec(name="ndim", doc="dimension of the probe", dtype="int", default_value=2),
NWBAttributeSpec(
# although the ProbeModel also has a name attribute, the name must be unique across all
# devices in the NWB file, and users may decide to use a more descriptive name than just
# the model name
name="model",
doc="Name of the model of the probe, e.g., 'Neuropixels 1.0'.",
dtype="text",
),
NWBAttributeSpec(
name="planar_contour_in_um", # TODO should this just be "contour"?
doc=("The coordinates of the nodes of the polygon that describe the shape (contour) of the probe, "
Expand All @@ -175,8 +183,8 @@ def main():
"See 'probe_planar_contour' in "
"https://probeinterface.readthedocs.io/en/main/format_spec.html for more details."),
dtype="float",
dims=[["num_points", "x"], ["num_points", "x, y"], ["num_points", "x, y, z"]],
shape=[[None, 1], [None, 2], [None, 3]],
dims=[["num_points", "x, y"], ["num_points", "x, y, z"]],
shape=[[None, 2], [None, 3]],
),
],
)
Expand Down

0 comments on commit bf90877

Please sign in to comment.