Skip to content

Commit 45871e3

Browse files
committed
Fix offset if unused shanks
1 parent be094b8 commit 45871e3

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/probeinterface/neuropixels_tools.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,11 @@ def read_openephys(
10811081
positions[:, 1] = positions[:, 1] - npx_descriptions[ptype]["shank_pitch"] * shank_ids
10821082

10831083
# x offset so that the first column is at 0x
1084-
positions[:, 0] -= np.min(positions[:, 0])
1084+
offset = np.min(positions[:, 0])
1085+
# if some shanks are not used, we need to adjust the offset
1086+
if shank_ids is not None:
1087+
offset -= np.min(shank_ids) * npx_descriptions[ptype]["shank_pitch"]
1088+
positions[:, 0] -= offset
10851089

10861090
contact_ids = []
10871091
for i, pos in enumerate(positions):

0 commit comments

Comments
 (0)