fix: validate gridscan params

This commit is contained in:
2026-09-07 10:06:55 +02:00
parent 1f47f1c16c
commit 2816f354fa
2 changed files with 14 additions and 15 deletions
+9
View File
@@ -1257,6 +1257,15 @@ class AareDAQ:
success=False, payload=payload, error=e, comment=additional_comment
)
def _validate_grid_params(self, request: RasterGridRequest):
self._devs.aerotech.validate_grid_scan(
grid_elem_size_y_um=request.grid_size_mm.y * 1000,
grid_elem_size_x_um=request.grid_size_mm.x * 1000,
grid_elem_count_x=request.n_x,
grid_elem_count_y=request.n_y,
time_sec=request.exp_time_s,
)
def _execute_raster_sequence(
self, grid_request: RasterGridRequest, auto_center: bool = False
) -> CompletedRasterGrid | None:
+5 -15
View File
@@ -421,19 +421,12 @@ class RasterService:
if self.ctx.sample is not None and self.ctx.sample.db_id is not None:
self.ctx.deps.aare.create_gridscan_run(self.ctx.sample, request, status)
if not self.ctx.deps.cfg.simulated_detector:
self.ctx.deps.jfjoch.wait_till_running(timeout=60.0)
else:
self.logger.info("Simulated detector mode enabled; faking jfjoch intilalisation.")
self.ctx.deps.jfjoch.wait_till_running(timeout=60.0)
self.logger.debug(
f"Starting grid scan with {request.n_x}x{request.n_y} points, exp time {request.exp_time_s}s"
)
if not self.ctx.deps.cfg.simulated_detector:
# The detector move (sa2dc) is non-blocking; ensure it has reached
# the requested distance before triggering the scan, so data is
# collected at the dtz already reported to JFJoch/DB.
self.ctx.deps.devs.set_dtz(request.dtz, wait=True)
self.ctx.deps.devs.set_dtz(request.dtz, wait=True)
self.ctx.deps.devs.aerotech.grid_scan(
grid_elem_size_y_um=request.grid_size_mm.y * 1000,
grid_elem_size_x_um=request.grid_size_mm.x * 1000,
@@ -747,12 +740,9 @@ class RasterService:
grid.omega_deg = geom.omega_deg
status = self.ctx.status
if not self.ctx.deps.cfg.simulated_detector:
self.logger.info("initialise detector")
self.ctx.deps.jfjoch.measure_raster(grid, status)
self.logger.info("detector initialised")
else:
self.logger.info("Simulated detector mode enabled; using fake raster result.")
self.logger.info("initialise detector")
self.ctx.deps.jfjoch.measure_raster(grid, status)
self.logger.info("detector initialised")
if self.ctx.services.state is None:
raise RuntimeError("RasterService requires services.state")