Skip to content

Commit 83c4f8b

Browse files
authored
Merge pull request #150 from SpikeInterface/np_ultra
Add NP-Ultra geometry to `read_openephys`
2 parents efb063d + 79f75c4 commit 83c4f8b

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

probeinterface/io.py

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,15 @@ def write_csv(file, probe):
778778
"elec_ids",
779779
),
780780
},
781+
'Ultra': {
782+
"x_pitch": 6,
783+
"y_pitch": 6,
784+
"contact_width": 5,
785+
"stagger": 0.0,
786+
"shank_pitch": 0,
787+
"shank_number": 1,
788+
"ncol": 8
789+
},
781790
#
782791
"Phase3a": {
783792
"probe_name": "Phase3a",
@@ -1319,6 +1328,9 @@ def read_openephys(
13191328
elif "1.0" in pname:
13201329
ptype = 0
13211330
x_shift = -11
1331+
elif "Ultra" in pname:
1332+
ptype = "Ultra"
1333+
x_shift = -8
13221334
else: # Probe type unknown
13231335
ptype = None
13241336
x_shift = 0
@@ -1333,7 +1345,7 @@ def read_openephys(
13331345
if ptype is None:
13341346
contact_ids = None
13351347
break
1336-
1348+
13371349
stagger = np.mod(pos[1] / npx_probe[ptype]["y_pitch"] + 1, 2) * npx_probe[ptype]["stagger"]
13381350
shank_id = shank_ids[0] if ptype == 24 else 0
13391351

@@ -1344,15 +1356,15 @@ def read_openephys(
13441356
else:
13451357
contact_ids.append(f"e{contact_id}")
13461358

1347-
13481359
np_probe_dict = {'channel_names': channel_names,
13491360
'shank_ids': shank_ids,
13501361
'contact_ids': contact_ids,
13511362
'positions': positions,
13521363
'slot': slot,
13531364
'port': port,
13541365
'dock': dock,
1355-
'serial_number': np_serial_number}
1366+
'serial_number': np_serial_number,
1367+
'ptype': ptype}
13561368
# Sequentially assign probe names
13571369
np_probe_dict.update({'name': probe_names_used[probe_idx]})
13581370
np_probes_info.append(np_probe_dict)
@@ -1441,15 +1453,20 @@ def read_openephys(
14411453
return None
14421454
probe_idx = 0
14431455

1444-
contact_width = 12
1445-
shank_pitch = 250
1446-
14471456
np_probe_info = np_probes_info[probe_idx]
14481457
np_probe = np_probes[probe_idx]
14491458
positions = np_probe_info['positions']
14501459
shank_ids = np_probe_info['shank_ids']
14511460
pname = np_probe.attrib['probe_name']
14521461

1462+
ptype = np_probe_info['ptype']
1463+
if ptype in npx_probe:
1464+
contact_width = npx_probe[ptype]['contact_width']
1465+
shank_pitch = npx_probe[ptype]['shank_pitch']
1466+
else:
1467+
contact_width = 12
1468+
shank_pitch = 250
1469+
14531470
probe = Probe(ndim=2, si_units="um")
14541471
probe.set_contacts(
14551472
positions=positions,

0 commit comments

Comments
 (0)