feat(daq): compute beam size for the mark overlay (rectangle, not crosshair)
Fill in the beam SIZE in save_screenshot_db using the same conversion the raster grid uses: beam_size_mm / pixel_to_mm(zoom) (sample-camera mm/px). The frontend now draws the beam rectangle (matching the gridscan) instead of a centre-only crosshair. Best-effort; falls back to crosshair on error. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
eaa9e1009b
commit
16be464d5b
+9
-8
@@ -2506,18 +2506,19 @@ class AareDAQ:
|
||||
filename: Name to give to the uploaded image.
|
||||
settle_time_s: float time to wait before taking the screenshot.
|
||||
"""
|
||||
# Beam-mark centre in sample-camera pixels at the current zoom, for the
|
||||
# DB overlay (drawn in the frontend, never baked into the JPEG). Best
|
||||
# effort — a calibration hiccup must never block the screenshot upload.
|
||||
# Beam-mark centre + size in sample-camera pixels at the current zoom,
|
||||
# for the DB overlay (drawn in the frontend, never baked into the JPEG).
|
||||
# Best effort — a calibration hiccup must never block the screenshot.
|
||||
beam_mark_pxl = None
|
||||
beam_size_pxl = None
|
||||
try:
|
||||
beam_mark_pxl = self.get_beam_mark()
|
||||
# TODO(calibration): beam SIZE in sample-camera pixels so the overlay
|
||||
# is a rectangle instead of a crosshair, e.g.
|
||||
# px_per_mm = ... # sample-camera scale at self.__devs.zoom
|
||||
# bs = self.__cfg.beam_size_mm
|
||||
# beam_size_pxl = (bs.x * px_per_mm, bs.y * px_per_mm)
|
||||
# Same conversion the raster grid uses (size_mm / pixel_in_mm);
|
||||
# pixel_to_mm(zoom) is the sample-camera scale in mm per pixel.
|
||||
pixel_in_mm = self.__cfg.pixel_to_mm(self.__devs.zoom)
|
||||
if pixel_in_mm and pixel_in_mm > 0:
|
||||
bs = self.__cfg.beam_size_mm
|
||||
beam_size_pxl = (bs.x / pixel_in_mm, bs.y / pixel_in_mm)
|
||||
except Exception:
|
||||
logger.warning("Could not read beam mark for screenshot overlay", exc_info=True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user