Skip to content

Commit b128d5e

Browse files
committed
merge
2 parents 6150261 + ae9277f commit b128d5e

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

src/probeinterface/io.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,33 +1765,29 @@ def read_openephys(
17651765
contact_ids = []
17661766
probe_dict = npx_probe[ptype]
17671767
shank_pitch = probe_dict["shank_pitch"]
1768-
y_pitch = probe_dict["y_pitch"] # Vertical spacing between the centers of adjacent contacts
1769-
x_pitch = probe_dict["x_pitch"] # Horizontal spacing between the centers of contacts within the same row
1768+
y_pitch = probe_dict["y_pitch"] # Vertical spacing between the centers of adjacent contacts
1769+
x_pitch = probe_dict["x_pitch"] # Horizontal spacing between the centers of contacts within the same row
17701770
number_of_columns = probe_dict["ncol"]
17711771
probe_stagger = probe_dict["stagger"]
1772-
shank_number = probe_dict["shank_number"]
1772+
shank_number = probe_dict["shank_number"]
17731773

17741774
for i, pos in enumerate(positions):
17751775
# Do not calculate contact ids if the probe type is not known
17761776
if ptype is None:
17771777
contact_ids = None
17781778
break
1779-
1779+
17801780
x_pos = pos[0]
17811781
y_pos = pos[1]
1782-
1782+
17831783
# Adds a shift to rows in the staggered configuration
17841784
is_row_staggered = np.mod(y_pos / y_pitch + 1, 2) == 1
1785-
row_stagger = probe_stagger if is_row_staggered else 0
1786-
1785+
row_stagger = probe_stagger if is_row_staggered else 0
1786+
17871787
# Map the positions to the contacts ids
17881788
shank_id = shank_ids[i] if shank_number > 1 else 0
1789-
contact_id = int(
1790-
(x_pos - row_stagger - shank_pitch * shank_id) / x_pitch
1791-
+ number_of_columns * y_pos / y_pitch
1792-
)
1793-
1794-
1789+
contact_id = int((x_pos - row_stagger - shank_pitch * shank_id) / x_pitch + number_of_columns * y_pos / y_pitch)
1790+
17951791
if shank_number > 1:
17961792
contact_ids.append(f"s{shank_id}e{contact_id}")
17971793
else:

0 commit comments

Comments
 (0)