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
80 changes: 20 additions & 60 deletions sentio_prober_control/Sentio/CommandGroups/AuxCommandGroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Optional, Tuple, List
from dataclasses import dataclass

from sentio_prober_control.Sentio.Enumerations import ChuckSite
from sentio_prober_control.Sentio.Enumerations import ChuckSite, ElementType
from sentio_prober_control.Sentio.Response import Response
from sentio_prober_control.Sentio.ProberBase import ProberException
from sentio_prober_control.Sentio.CommandGroups.AuxCleaningGroup import AuxCleaningGroup
Expand All @@ -22,9 +22,10 @@ def __init__(self, raw_response: str) -> None:
parts = raw_response.split(",")
if len(parts) < 7:
raise ProberException("Unexpected response for element info.")

# Parse the parts into an ElementInfo object.
self.element_info = ElementInfo(
element_type=ElementType.from_str(parts[0]),
element_type=ElementType.from_string(parts[0]),
element_subtype=parts[1],
x_position=float(parts[2]),
y_position=float(parts[3]),
Expand All @@ -40,28 +41,8 @@ def get_element_info(self) -> "ElementInfo":
"""
return self.element_info

# --- New Enumerator for element types ---
class ElementType(Enum):
"""Represents the type of a calibration element."""
Open = 0
Short = 1
Thru = 2
Load = 3
Align = 4
Unknown = 99

@classmethod
def from_str(cls, s: str) -> "ElementType":
mapping = {
"open": cls.Open,
"short": cls.Short,
"thru": cls.Thru,
"load" : cls.Load,
"align": cls.Align
}
return mapping.get(s.lower(), cls.Unknown)

# --- New data class for element information ---


@dataclass
class ElementInfo:
element_type: ElementType
Expand All @@ -72,7 +53,7 @@ class ElementInfo:
touch_count: int
life_time: float

# --- Updated AuxCommandGroup with eleven API methods ---

class AuxCommandGroup(ModuleCommandGroupBase):
"""This command group contains functions for working with auxiliary sites of the chuck.
You are not meant to create instances of this class on your own. Instead, use the aux
Expand All @@ -82,9 +63,9 @@ class AuxCommandGroup(ModuleCommandGroupBase):
cleaning (AuxCleaningGroup): A subgroup to provide logic for probe cleaning.
"""

def __init__(self, comm) -> None:
super().__init__(comm, "aux")
self.cleaning: AuxCleaningGroup = AuxCleaningGroup(comm)
def __init__(self, prober : 'SentioProber') -> None:
super().__init__(prober, "aux")
self.cleaning: AuxCleaningGroup = AuxCleaningGroup(prober)

# --- Helper method to validate that the given site is an auxiliary site ---
def _validate_aux_site(self, site: "ChuckSite") -> None:
Expand All @@ -93,9 +74,6 @@ def _validate_aux_site(self, site: "ChuckSite") -> None:
if site in (ChuckSite.Wafer, ChuckSite.ChuckCamera):
raise ProberException(f"Invalid auxiliary site: {site.name}.")

# -------------------------------------------------------------------------
# 1) retrieve_substrate_data
# -------------------------------------------------------------------------
def retrieve_substrate_data(self, site: Optional["ChuckSite"] = None) -> List["ChuckSite"]:
"""
Retrieves contact and home information from the configuration file and assigns it
Expand All @@ -115,7 +93,7 @@ def retrieve_substrate_data(self, site: Optional["ChuckSite"] = None) -> List["C
cmd = "aux:retrieve_substrate_data"
if site:
self._validate_aux_site(site)
cmd += f" {site.toSentioAbbr()}"
cmd += f" {site.to_string()}"

self.comm.send(cmd)
resp = Response.check_resp(self.comm.read_line())
Expand All @@ -129,14 +107,11 @@ def retrieve_substrate_data(self, site: Optional["ChuckSite"] = None) -> List["C
for token in parts[1:]:
token = token.strip()
for aux_site in ChuckSite:
if token.lower() == aux_site.toSentioAbbr().lower():
if token.lower() == aux_site.to_string().lower():
sites.append(aux_site)
break
return sites

# -------------------------------------------------------------------------
# 2) get_substrate_type
# -------------------------------------------------------------------------
def get_substrate_type(self, site: Optional["ChuckSite"] = None) -> str:
"""
Retrieves the type of a calibration substrate placed on the chuck.
Expand All @@ -155,7 +130,7 @@ def get_substrate_type(self, site: Optional["ChuckSite"] = None) -> str:
cmd = "aux:get_substrate_type"
if site:
self._validate_aux_site(site)
cmd += f" {site.toSentioAbbr()}"
cmd += f" {site.to_string()}"

self.comm.send(cmd)
resp = Response.check_resp(self.comm.read_line())
Expand All @@ -164,9 +139,6 @@ def get_substrate_type(self, site: Optional["ChuckSite"] = None) -> str:
return ""
return substrate_type

# -------------------------------------------------------------------------
# 3) step_to_element
# -------------------------------------------------------------------------
def step_to_element(
self,
element_standard_id: str,
Expand All @@ -193,9 +165,6 @@ def step_to_element(
self.comm.send(cmd)
Response.check_resp(self.comm.read_line())

# -------------------------------------------------------------------------
# 4) step_to_dut_element
# -------------------------------------------------------------------------
def step_to_dut_element(
self,
dut_name: str,
Expand All @@ -221,9 +190,6 @@ def step_to_dut_element(
self.comm.send(cmd)
Response.check_resp(self.comm.read_line())

# -------------------------------------------------------------------------
# 5) get_element_type
# -------------------------------------------------------------------------
def get_element_type(self, element_standard_id: str, site: Optional["ChuckSite"] = None) -> ElementType:
"""
Retrieves the type of an element on a calibration substrate placed on the chuck.
Expand All @@ -241,18 +207,15 @@ def get_element_type(self, element_standard_id: str, site: Optional["ChuckSite"]
cmd = "aux:get_element_type"
if site:
self._validate_aux_site(site)
cmd += f" {site.toSentioAbbr()},{element_standard_id}"
cmd += f" {site.to_string()},{element_standard_id}"
else:
cmd += f" {element_standard_id}"

self.comm.send(cmd)
resp = Response.check_resp(self.comm.read_line())
result = resp.message()
return ElementType.from_str(result)
return ElementType.from_string(result)

# -------------------------------------------------------------------------
# 6) get_substrate_info
# -------------------------------------------------------------------------
def get_substrate_info(self, site: "ChuckSite") -> Tuple[str, str, float]:
"""
Retrieves information of a calibration substrate or cleaning pad placed on a chuck site.
Expand All @@ -269,7 +232,7 @@ def get_substrate_info(self, site: "ChuckSite") -> Tuple[str, str, float]:
- life_time (float) in %
"""
self._validate_aux_site(site)
cmd = f"aux:get_substrate_info {site.toSentioAbbr()}"
cmd = f"aux:get_substrate_info {site.to_string()}"
self.comm.send(cmd)
resp = Response.check_resp(self.comm.read_line())
parts = resp.message().split(",")
Expand All @@ -282,9 +245,6 @@ def get_substrate_info(self, site: "ChuckSite") -> Tuple[str, str, float]:
life_time = float(parts[2])
return (substrate_type, substrate_id, life_time)

# -------------------------------------------------------------------------
# 7) get_element_touch_count
# -------------------------------------------------------------------------
def get_element_touch_count(self, element_standard_id: str, site: Optional["ChuckSite"] = None) -> int:
"""
Retrieves the touch count of an element on a calibration substrate placed on the chuck.
Expand All @@ -302,7 +262,7 @@ def get_element_touch_count(self, element_standard_id: str, site: Optional["Chuc
cmd = "aux:get_element_touch_count"
if site:
self._validate_aux_site(site)
cmd += f" {site.toSentioAbbr()},{element_standard_id}"
cmd += f" {site.to_string()},{element_standard_id}"
else:
cmd += f" {element_standard_id}"

Expand Down Expand Up @@ -330,7 +290,7 @@ def get_element_spacing(self, element_standard_id: str, site: Optional["ChuckSit
cmd = "aux:get_element_spacing"
if site:
self._validate_aux_site(site)
cmd += f" {site.toSentioAbbr()},{element_standard_id}"
cmd += f" {site.to_string()},{element_standard_id}"
else:
cmd += f" {element_standard_id}"

Expand Down Expand Up @@ -358,7 +318,7 @@ def get_element_pos(self, element_standard_id: str, site: Optional["ChuckSite"]
cmd = "aux:get_element_pos"
if site:
self._validate_aux_site(site)
cmd += f" {site.toSentioAbbr()},{element_standard_id}"
cmd += f" {site.to_string()},{element_standard_id}"
else:
cmd += f" {element_standard_id}"

Expand Down Expand Up @@ -391,7 +351,7 @@ def get_element_life_time(self, element_standard_id: str, site: Optional["ChuckS
cmd = "aux:get_element_life_time"
if site:
self._validate_aux_site(site)
cmd += f" {site.toSentioAbbr()},{element_standard_id}"
cmd += f" {site.to_string()},{element_standard_id}"
else:
cmd += f" {element_standard_id}"

Expand Down Expand Up @@ -434,7 +394,7 @@ def get_element_info(self, element_standard_id: str, site: Optional["ChuckSite"]
if site is not None:
self._validate_aux_site(site)
# First parameter is the optional chuck site, second is the element ID
cmd += f" {site.toSentioAbbr()},{element_standard_id}"
cmd += f" {site.to_string()},{element_standard_id}"
else:
# Only the element ID is passed if the site is omitted
cmd += f" {element_standard_id}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ class CompensationCommandGroup(CommandGroupBase):
Use the SentioProber.vis.compensation group instead!
"""

def __init__(self, comm) -> None:
def __init__(self, prober : 'SentioProber') -> None: # type: ignore
"""@private"""
super().__init__(comm)
super().__init__(prober)


@deprecated(reason="Use prober.vis.compensation.set_compensation instead.")
Expand All @@ -28,7 +28,7 @@ def set_compensation(self, comp: Compensation, enable: bool):
>>> prober.vis.compensation.set_compensation(comp, enable)
"""

self.comm.send(f"vis:compensation:enable {comp.toSentioAbbr()}, {enable}")
self.comm.send(f"vis:compensation:enable {comp.to_string()}, {enable}")
resp = Response.check_resp(self.comm.read_line())
tok = resp.message().split(",")
return tok[0], tok[1]
Expand All @@ -44,7 +44,7 @@ def execute_compensation(self, comp: ExecuteCompensation, mode: OnTheFlyMode):
"""
self.comm.send(
"vis:compensation:start_execute {},{}".format(
comp.toSentioAbbr(), mode.toSentioAbbr()
comp.to_string(), mode.to_string()
)
)
resp = Response.check_resp(self.comm.read_line())
Expand Down
Loading