From e1866c008519499305b7a679599307d2991223e9 Mon Sep 17 00:00:00 2001 From: appleb_m Date: Fri, 6 Feb 2026 15:58:00 +0100 Subject: [PATCH] Common: added aerotech coordinate model for using smargon to interface aerotech --- src/aare/common/coordinate.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/aare/common/coordinate.py b/src/aare/common/coordinate.py index edbdebc4..76da6e25 100644 --- a/src/aare/common/coordinate.py +++ b/src/aare/common/coordinate.py @@ -102,3 +102,21 @@ def positive_coords(value: Coordinate) -> Coordinate: if value.x <= 0 or value.y <= 0: raise ValueError("Coordinates must be positive") return value + + +class AerotechCoordinate(BaseModel): + at_mm: Optional[Coordinate] = None + omega_deg: Optional[float] = None + + def eq(self, other: "AerotechCoordinate", tol: float) -> bool: + return ( + abs(self.at_mm.x - other.at_mm.x) < tol + and abs(self.at_mm.y - other.at_mm.y) < tol + and abs(self.at_mm.z - other.at_mm.z) < tol + and abs(self.omega_deg - other.omega_deg) < tol + ) + + def __eq__(self, other: object) -> bool: + if isinstance(other, AerotechCoordinate): + return self.eq(other, tol=0.01) + return NotImplemented \ No newline at end of file