DAQ: possible TODOS for daq.py
Build and Publish / build (push) Successful in 55s
Build and Publish / Build and Deploy Docs (push) Successful in 45s

This commit is contained in:
2026-04-15 17:05:37 +02:00
parent 347aea4cb0
commit 74c3a9f4ba
+7 -5
View File
@@ -53,7 +53,7 @@ from aare.common.exception_handler import (
)
logger = setup_logger("aareDAQ")
#TODO tidy up DAQ - migrate functions itno different scripts, to reduce size?
class AareDAQ:
MIN_SPOTS_LOW_RES_THRESHOLD = 10.0
@@ -82,7 +82,7 @@ class AareDAQ:
self._face_detection_progress_cb(payload)
except Exception as e:
logger.warning(f"Failed to emit face detection progress: {e}")
#TODO make sure this is implemented currectly
def _handle_operation_error(self, operation_name: str, sample: SampleShortInfo | None, error: Exception,
error_type: str = "generic") -> None:
"""
@@ -109,7 +109,7 @@ class AareDAQ:
self.__aare.sample_failed(sample, failed_comment=f"Error in {operation_name}: {error}")
except Exception as db_error:
logger.error(f"Failed to report {operation_name} error to database: {db_error}")
#todo make sure these functions are correctly implemented!
def _execute_mount_and_prepare(self, sample: SampleShortInfo) -> bool:
"""
Execute mounting and take screenshot.
@@ -788,6 +788,7 @@ class AareDAQ:
def __auto_center(self, request: RasterGridRequest) -> CompletedRasterGrid | None:
#TODO do we need to handle the two grid scans differently?
sample = self.sample
if sample is None:
@@ -858,7 +859,7 @@ class AareDAQ:
self.__devs.set_smargon_pos(SmargonCoordinate(sh_mm=request.smargon_top_left.sh_mm,
phi_deg=request.smargon_top_left.phi_deg,
chi_deg=request.smargon_top_left.chi_deg))
#todo ADD TRANSMISSION
#if request.transmission is not None:
# self.__devs.transmission.wait()
self.__devs.smargon_wait(timeout=180)
@@ -1375,6 +1376,7 @@ class AareDAQ:
return
#TODO operator function similar to mount, loop_center, raster and rotation
def __face_detection_sequence(self, steps: int = 14, step_size: int = 15, face_min_ratio: float = 0.3) -> dict:
self.__set_state(BeamlineStateEnum.SampleAlignment)
self.__devs.lamp_light = 2.5
@@ -1910,7 +1912,7 @@ class AareDAQ:
except Exception as e:
logger.error(f"Error in measure: {e}")
self._handle_operation_error("measure", sample, e, error_type="generic")
#TODO under what circumstances should this raise an error?
finally:
logger.debug(f"finally at {time.perf_counter() - start}")