Skip to content

Commit a1f9f94

Browse files
committed
Add NP2020 and fix OE contour
1 parent 26634d6 commit a1f9f94

1 file changed

Lines changed: 33 additions & 6 deletions

File tree

src/probeinterface/neuropixels_tools.py

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,28 @@
197197
),
198198
"oe_x_shift": -8,
199199
},
200+
# NXT
201+
"2020": {
202+
"model_name": "Neuropixels 2.0 Quad Base",
203+
"x_pitch": 32,
204+
"y_pitch": 15,
205+
"contact_width": 12,
206+
"stagger": 0.0,
207+
"shank_pitch": 250,
208+
"shank_number": 4,
209+
"ncols_per_shank": 2,
210+
"nrows_per_shank": 640,
211+
"contour_description": "np70",
212+
"contour_shift": [-27, -11],
213+
"fields_in_imro_table": (
214+
"channel_ids",
215+
"shank_id",
216+
"banks",
217+
"references",
218+
"elec_ids",
219+
),
220+
"oe_x_shift": -8,
221+
},
200222
# Experimental probes previous to 1.0
201223
"Phase3a": {
202224
"model_name": "Phase3a",
@@ -403,7 +425,7 @@
403425
"lf_gains",
404426
"ap_hp_filters",
405427
),
406-
"oe_x_shift": -8,
428+
"oe_x_shift": -12,
407429
},
408430
# Ultra probes 16 banks
409431
"1110": {
@@ -506,6 +528,8 @@
506528
"NP2004": "2004",
507529
"PRB2_1_2_0640_0": "21",
508530
"PRB2_4_2_0640_0": "24",
531+
# NXT
532+
"NP2020": "2020",
509533
# Ultra
510534
"NP1100": "1100", # Ultra probe - 1 bank
511535
"NP1110": "1110", # Ultra probe - 16 banks no handle beacuse
@@ -1052,7 +1076,9 @@ def read_openephys(
10521076

10531077
# check if shank ids is present
10541078
if all(":" in val for val in channel_values):
1055-
shank_ids = np.array([int(val[val.find(":") + 1 :]) for val in channel_values])
1079+
shank_ids = np.array([int(val.split(":")[1]) for val in channel_values])
1080+
elif all("_" in val for val in channel_names):
1081+
shank_ids = np.array([int(val.split("_")[1]) for val in channel_names])
10561082
else:
10571083
shank_ids = None
10581084

@@ -1122,6 +1148,7 @@ def read_openephys(
11221148
# now select correct probe (if multiple)
11231149
if len(np_probes) > 1:
11241150
found = False
1151+
probe_names = [p["name"] for p in np_probes_info]
11251152

11261153
if stream_name is not None:
11271154
assert probe_name is None and serial_number is None, (
@@ -1166,8 +1193,8 @@ def read_openephys(
11661193
return None
11671194
else:
11681195
raise Exception(
1169-
"More than one probe found. Use one of 'stream_name', 'probe_name', or 'serial_number' "
1170-
"to select the right probe"
1196+
f"More than one probe found. Use one of 'stream_name', 'probe_name', or 'serial_number' "
1197+
f"to select the right probe.\nProbe names: {probe_names}"
11711198
)
11721199
else:
11731200
# in case of a single probe, make sure it is consistent with optional
@@ -1205,7 +1232,6 @@ def read_openephys(
12051232
np_probe = np_probes[probe_idx]
12061233
positions = np_probe_info["positions"]
12071234
shank_ids = np_probe_info["shank_ids"]
1208-
pname = np_probe_info["name"]
12091235

12101236
ptype = np_probe_info["ptype"]
12111237
if ptype in npx_descriptions:
@@ -1257,6 +1283,7 @@ def read_openephys(
12571283
probe.set_contact_ids(contact_ids)
12581284

12591285
polygon = polygon_contour_description[contour_description]
1286+
contour_shift = np.array(npx_descriptions[ptype]["contour_shift"])
12601287
if shank_ids is None:
12611288
contour = polygon
12621289
else:
@@ -1265,7 +1292,7 @@ def read_openephys(
12651292
contour += list(np.array(polygon) + [shank_pitch * i, 0])
12661293

12671294
# shift
1268-
contour = np.array(contour) - x_shift
1295+
contour = np.array(contour) + contour_shift
12691296
probe.set_planar_contour(contour)
12701297

12711298
# wire it

0 commit comments

Comments
 (0)