Skip to content

Commit 1514613

Browse files
author
Thinh Nguyen
committed
bugfix in geomap to shank conversion
1 parent 9857aef commit 1514613

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

element_array_ephys/readers/spikeglx.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ def _parse_geommap(raw):
404404
405405
{'shape': [x,y,z], 'data': [[a,b,c,d],...]}
406406
"""
407-
res = {"shape": None, "data": []}
407+
res = {"header": None, "data": []}
408408

409409
for u in (i.rstrip(")") for i in raw.split("(") if i != ""):
410410
if "," in u:
@@ -459,12 +459,17 @@ def _transform_geom_to_shank(self):
459459
probe_params["probe_type"] = self.probe_PN
460460
elec_pos_df = probe_geometry.build_npx_probe(**probe_params)
461461

462-
res = {"shape": self.geommap["shape"], "data": []}
462+
res = {"shape": self.geommap["header"], "data": []}
463463
for shank, x_coord, y_coord, is_used in self.geommap["data"]:
464+
# offset shank pitch
465+
x_coord += probe_params["shankPitch"] * shank
464466
matched_elec = elec_pos_df.query(
465467
f"x_coord=={x_coord} & y_coord=={y_coord} & shank=={shank}"
466468
)
467-
shank_col, shank_row = matched_elec.shank_col, matched_elec.shank_row
469+
shank_col, shank_row = (
470+
matched_elec.shank_col.iloc[0],
471+
matched_elec.shank_row.iloc[0],
472+
)
468473
res["data"].append([shank, shank_col, shank_row, is_used])
469474

470475
return res

0 commit comments

Comments
 (0)