Skip to content

Commit a6d8ea4

Browse files
committed
backward compatible shan_ids [''] -> None
1 parent e57ce96 commit a6d8ea4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/probeinterface/probe.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -945,13 +945,19 @@ def from_dict(d: dict) -> "Probe":
945945
"""
946946
probe = Probe(ndim=d["ndim"], si_units=d["si_units"])
947947

948+
949+
shank_ids=d.get("shank_ids", None)
950+
if shank_ids is not None and np.all(shank_ids == ''):
951+
# backward compatible hack with previous version
952+
shank_ids = None
953+
948954
probe.set_contacts(
949955
positions=d["contact_positions"],
950956
plane_axes=d["contact_plane_axes"],
951957
shapes=d["contact_shapes"],
952958
shape_params=d["contact_shape_params"],
953959
contact_ids=d.get("contact_ids", None),
954-
shank_ids=d.get("shank_ids", None),
960+
shank_ids=shank_ids,
955961
contact_sides=d.get("contact_sides", None),
956962
)
957963

0 commit comments

Comments
 (0)