feat: add sample info holder
CI for mx_bec / test (push) Failing after 48s

This commit is contained in:
perl_d committed 2026-11-03 15:17:10 +01:00
1 parent d0cfcac249
commit 71cd3ac6b4
2 files changed
+26

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
from __future__ import annotations
from pydantic import BaseModel, Field
class OpticalCenteringResults:
"""Outputs from the optical centering stage"""
found: bool
smargon_coordinates: tuple[float, float, float] = Field(
description="x,y,z motor coords of the smargon where the crystal was centred"
)
type_used: str = Field(description="Image analysis element used to determine the center")
class SampleInfo(BaseModel):
"""Information about the currently mounted sample. Gradually filled out as
information from previous stages is obtained"""
sample_id: int
optical_centering_results: OpticalCenteringResults | None = None
+5
View File
@@ -14,6 +14,7 @@ from mx_bec.endpoints import TaskEndpoints
from mx_bec.jfjoch import JFJoch
from mx_bec.messages import MXTaskQueueChangedMessage
from mx_bec.optical_centering import OpticalPrediction
from mx_bec.sample_info import SampleInfo
from mx_bec.tasks import MxTaskQueue, MxTasks
if TYPE_CHECKING:
@@ -49,6 +50,7 @@ class AareBec(BECClient):
self.jfjoch = JFJoch(client=self) # connects lazily on first use
self.tasks = MxTasks(self)
self.task_queue: MxTaskQueue | None = None
self.sample_info: SampleInfo | None = None
def start(self):
super().start()
@@ -78,6 +80,9 @@ class AareBec(BECClient):
def _start_actor_manager(self):
self.actor_manager = AareActorManager(self)
def reset_sample_info(self, sample_id: int):
self.sample_info = SampleInfo(sample_id=sample_id)
def shutdown(self, per_thread_timeout_s: float | None = None) -> None:
"""shutdown the service"""
if self.actor_manager is not None: