Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ def get_probe_site(self, probe: ProbePosition, idx: int) -> Tuple[str, float, fl
Returns:
A tuple containing the site index, position x, the position y in micrometer and the reference.
"""

# This command was briefly removed and is not part of the SENTIO 24.0
# release. It was reintroduced in 25.1.
Compatibility.assert_min(CompatibilityLevel.Sentio_25_1)

self.comm.send(f"get_positioner_site {probe.to_string()},{idx}")
resp = Response.check_resp(self.comm.read_line())
tok = resp.message().split(",")
Expand Down
10 changes: 7 additions & 3 deletions sentio_prober_control/Sentio/Compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ class CompatibilityLevel(IntEnum):
It is used to determine which features are available in the prober. This enum
only contains SENTIO versions which introduces API changes.
"""
# Undefined compatibility level, used for prober instances that are not yet initialized.
# Do NOT use this value in your code production code. It is signalling an uninitialized
# state.
Auto = 0
Sentio_24 = 1
Sentio_25_2 = 2
Sentio_24_0 = 1
Sentio_25_1 = 2
Sentio_25_2 = 3
Experimental = 99


Expand All @@ -36,4 +40,4 @@ def assert_min(level : CompatibilityLevel) -> None:
RuntimeError: If the current compatibility level is lower than the required level.
"""
if Compatibility.level < level:
raise RuntimeError(f"Compatibility level {Compatibility.level} is lower than required {level}.")
raise RuntimeError(f"This command is not supported by your machine! The machine reports a compatibility level of {Compatibility.level.name} but {level.name} is required to execute the command.")
22 changes: 17 additions & 5 deletions sentio_prober_control/Sentio/ProberSentio.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,24 @@ def __init__(self, comm: CommunicatorBase, compat_level : CompatibilityLevel = C
major = int(parts[0]) if len(parts) > 0 else None
minor = int(parts[1]) if len(parts) > 1 else None
release = int(parts[2]) if len(parts) > 2 else None
if major==25 and (minor==2 or (minor==1 and release==99)):
if major==25 and (minor==1 or (minor==0 and release==99)):
Compatibility.level = CompatibilityLevel.Sentio_25_1
elif major==25 and (minor==2 or (minor==1 and release==99)):
Compatibility.level = CompatibilityLevel.Sentio_25_2
else:
Compatibility.level = CompatibilityLevel.Sentio_24
Compatibility.level = CompatibilityLevel.Sentio_24_0

# make sure there is a valid compatibility level now
assert Compatibility.level != CompatibilityLevel.Auto, "Compatibility level could not be determined. Please set it manually."

#
# More command groups not supported by all SENTIO versions.
#

# The probe command group has optional sub-groups for top and bottom probes.
# These are only available for Sentio > 25.2
# The probe command group has optional sub-groups for top and bottom
# probes. These are only available for Sentio > 25.2. Therefore
# this command group must be initialized after determining the
# compatibility level.
self.probe: ProbeCommandGroup = ProbeCommandGroup(self)

# Command groups for stages; Only available for Sentio > 25.2
Expand Down Expand Up @@ -482,7 +489,8 @@ def get_scope_z(self) -> float:
def get_scope_site(self, idx : int) -> Tuple[str, float, float, bool]:
""" Get scope site data.

This command queries the name and position of a scope site. The index is zero based.
This command queries the name and position of a scope site. The index
is zero based.

Args:
idx (int): The index of the site to query.
Expand All @@ -491,6 +499,10 @@ def get_scope_site(self, idx : int) -> Tuple[str, float, float, bool]:
num (int): The number of defined scope sites.
"""

# This command was briefly removed and is not part of the SENTIO 24.0
# release. It was reintroduced in 25.2.
Compatibility.assert_min(CompatibilityLevel.Sentio_25_2)

self.comm.send(f"get_scope_site {idx}")
resp = Response.check_resp(self.comm.read_line())
tok = resp.message().split(",")
Expand Down