@@ -93,8 +93,9 @@ def to_probeinterface(ndx_probe) -> Probe:
9393 for possible_shape_key in possible_shape_keys :
9494 if possible_shape_key in contact_table .colnames :
9595 if shape_params is None :
96- shape_params = []
97- shape_params .append ([{possible_shape_key : val } for val in contact_table [possible_shape_key ][:]])
96+ shape_params = [{} for _ in range (len (contact_table ))]
97+ for i in range (len (contact_table )):
98+ shape_params [i ][possible_shape_key ] = contact_table [possible_shape_key ][i ]
9899
99100 positions = [item for sublist in positions for item in sublist ]
100101 shapes = [item for sublist in shapes for item in sublist ]
@@ -103,8 +104,6 @@ def to_probeinterface(ndx_probe) -> Probe:
103104 contact_ids = [item for sublist in contact_ids for item in sublist ]
104105 if plane_axes is not None :
105106 plane_axes = [item for sublist in plane_axes for item in sublist ]
106- if shape_params is not None :
107- shape_params = [item for sublist in shape_params for item in sublist ]
108107 if shank_ids is not None :
109108 shank_ids = [item for sublist in shank_ids for item in sublist ]
110109 if device_channel_indices is not None :
@@ -170,13 +169,19 @@ def _single_probe_to_nwb_device(probe: Probe):
170169 contact_table .add_row (kwargs )
171170
172171 annotations = probe .annotations .copy ()
173- name = annotations .pop ("name" ) if "name" in annotations else None
174- serial_number = annotations .pop ("serial_number" ) if "serial_number" in annotations else None
175- model_name = annotations .pop ("model_name" ) if "model_name" in annotations else None
176- manufacturer = annotations .pop ("manufacturer" ) if "manufacturer" in annotations else None
172+ name = probe .name
173+ serial_number = probe .serial_number
174+ model_name = probe .model_name
175+ manufacturer = probe .manufacturer
176+
177+ # Remove key annotations already stored as attributes in the Probe device
178+ annotations .pop ("name" , None )
179+ annotations .pop ("serial_number" , None )
180+ annotations .pop ("model_name" , None )
181+ annotations .pop ("manufacturer" , None )
177182
178183 probe_device = Probe (
179- name = name ,
184+ name = name if name is not None else "Probe" ,
180185 model_name = model_name ,
181186 serial_number = serial_number ,
182187 manufacturer = manufacturer ,
0 commit comments