diff --git a/requirements.txt b/requirements.txt index 80b306a..458c2c7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ # pinned dependencies to reproduce a working development environment hdmf>=3.1.1 pynwb>=2.0.0 -probeinterface>=0.2.18 +probeinterface>=0.3.0 diff --git a/src/pynwb/ndx_probeinterface/io.py b/src/pynwb/ndx_probeinterface/io.py index 07993ed..8785149 100644 --- a/src/pynwb/ndx_probeinterface/io.py +++ b/src/pynwb/ndx_probeinterface/io.py @@ -93,8 +93,9 @@ def to_probeinterface(ndx_probe) -> Probe: for possible_shape_key in possible_shape_keys: if possible_shape_key in contact_table.colnames: if shape_params is None: - shape_params = [] - shape_params.append([{possible_shape_key: val} for val in contact_table[possible_shape_key][:]]) + shape_params = [{} for _ in range(len(contact_table))] + for i in range(len(contact_table)): + shape_params[i][possible_shape_key] = contact_table[possible_shape_key][i] positions = [item for sublist in positions for item in sublist] shapes = [item for sublist in shapes for item in sublist] @@ -103,8 +104,6 @@ def to_probeinterface(ndx_probe) -> Probe: contact_ids = [item for sublist in contact_ids for item in sublist] if plane_axes is not None: plane_axes = [item for sublist in plane_axes for item in sublist] - if shape_params is not None: - shape_params = [item for sublist in shape_params for item in sublist] if shank_ids is not None: shank_ids = [item for sublist in shank_ids for item in sublist] if device_channel_indices is not None: @@ -170,13 +169,19 @@ def _single_probe_to_nwb_device(probe: Probe): contact_table.add_row(kwargs) annotations = probe.annotations.copy() - name = annotations.pop("name") if "name" in annotations else None - serial_number = annotations.pop("serial_number") if "serial_number" in annotations else None - model_name = annotations.pop("model_name") if "model_name" in annotations else None - manufacturer = annotations.pop("manufacturer") if "manufacturer" in annotations else None + name = probe.name + serial_number = probe.serial_number + model_name = probe.model_name + manufacturer = probe.manufacturer + + # Remove key annotations already stored as attributes in the Probe device + annotations.pop("name", None) + annotations.pop("serial_number", None) + annotations.pop("model_name", None) + annotations.pop("manufacturer", None) probe_device = Probe( - name=name, + name=name if name is not None else "Probe", model_name=model_name, serial_number=serial_number, manufacturer=manufacturer, diff --git a/src/pynwb/ndx_probeinterface/version.py b/src/pynwb/ndx_probeinterface/version.py index 181e9f0..8d16a47 100644 --- a/src/pynwb/ndx_probeinterface/version.py +++ b/src/pynwb/ndx_probeinterface/version.py @@ -1 +1 @@ -version = "0.2.0" +version = "0.2.1" diff --git a/src/spec/create_extension_spec.py b/src/spec/create_extension_spec.py index 127dc22..bce467a 100644 --- a/src/spec/create_extension_spec.py +++ b/src/spec/create_extension_spec.py @@ -9,7 +9,7 @@ def main(): ns_builder = NWBNamespaceBuilder( doc="""Extension for defining neural probes in the probeinterface format""", name="""ndx-probeinterface""", - version="""0.1.0""", + version="""0.2.1""", author=["Alessio Buccino", "Kyu Hyun Lee", "Geeling Chau"], contact=["alessiop.buccino@gmail.com", "kyuhyun9056@gmail.com", "gchau@caltech.edu"], )