From 8a5bdf142a6ad002355e33a65835e28a522f9699 Mon Sep 17 00:00:00 2001 From: appleb_m Date: Wed, 24 Jun 2026 22:53:37 +0200 Subject: [PATCH] new_gui: remove focus-measure (unused in current beamline GUI) Stop enabling/displaying the per-frame focus metric; also lightens the camera thread's per-frame work. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/aare/gui/new_gui/README.md | 9 +++++---- src/aare/gui/new_gui/ROADMAP.md | 2 +- src/aare/gui/new_gui/main_window.py | 4 ---- src/aare/gui/new_gui/widgets/camera.py | 7 ------- 4 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/aare/gui/new_gui/README.md b/src/aare/gui/new_gui/README.md index c4210699..91901d14 100644 --- a/src/aare/gui/new_gui/README.md +++ b/src/aare/gui/new_gui/README.md @@ -61,10 +61,11 @@ Backend contract is documented in the `new-gui-backend-paths` memory. - **Baton** chip ← `baton_status_changed`. - **Sample list** ← `spreadsheet` → Sample Changer + Library. - **Camera** ← `PredictionSubscriber` (live SAMCAM image, fps, target point). - ML detection overlays (boxes + convex-hull polygons, per-class colours), a - state-coloured beam-centre marker (`geom.beam_location_pxl`), and a focus - readout (`focus_measure`). Camera controls (⚙ gain/exposure → `samcam_settings`, - AF → `autofocus`, ◉ → `send_screenshot_db`) live in the tab strip. + ML detection overlays (boxes + convex-hull polygons, per-class colours) and a + state-coloured beam-centre marker (`geom.beam_location_pxl`). Inline camera + Exp/Gain (`samcam_settings`), AF (`autofocus`), and screenshot + (`send_screenshot_db`) live in the tab strip. (Focus-measure is disabled — + unused in the current beamline GUI.) - **Gonio / Beamline tabs** ← axis IP video via `VideoThread` (`frame_ready`). - **Staff Tools** (⚙ Tools in the top bar, staff only) — a tabbed dialog (`widgets/staff_tools.py`): **Beam/detector** (beam centre/size/mark, ABR diff --git a/src/aare/gui/new_gui/ROADMAP.md b/src/aare/gui/new_gui/ROADMAP.md index f938c401..aaada39f 100644 --- a/src/aare/gui/new_gui/ROADMAP.md +++ b/src/aare/gui/new_gui/ROADMAP.md @@ -21,7 +21,7 @@ Start→`automated_scan`). - ML detection boxes/polygons (Crystal/Loop/Pin/Ice/Needle colours) ← `prediction_subscriber.prediction` - Beam-centre crosshair marker ← `status.geom.beam_location_pxl` - Camera exposure/gain controls + screenshot-to-DB(+metadata) ← `samcam_settings`, `send_screenshot_db` -- Focus-measure readout ← `prediction_subscriber.focus_measure` +- ~~Focus-measure readout~~ — removed (unused in the current beamline GUI) - Smargon bookmarks (Ctrl+click position markers) ← `models/bookmark.py` - Helical start/end markers (only if helical is in scope) diff --git a/src/aare/gui/new_gui/main_window.py b/src/aare/gui/new_gui/main_window.py index 010a26ce..3f672290 100644 --- a/src/aare/gui/new_gui/main_window.py +++ b/src/aare/gui/new_gui/main_window.py @@ -305,10 +305,6 @@ class MainWindow(QWidget): self.camera_thread.target_point.connect(cam.update_target_point) if hasattr(self.camera_thread, "prediction"): self.camera_thread.prediction.connect(cam.update_predictions) - if hasattr(self.camera_thread, "focus_measure"): - self.camera_thread.focus_measure.connect(cam.update_focus) - if hasattr(self.camera_thread, "enable_focus_measurement"): - self.camera_thread.enable_focus_measurement(True) if hasattr(self.camera_thread, "update_daq_status"): self.daq.update.connect(self.camera_thread.update_daq_status) # staff-view camera mirrors the same stream diff --git a/src/aare/gui/new_gui/widgets/camera.py b/src/aare/gui/new_gui/widgets/camera.py index ef2426b4..70e2f76d 100644 --- a/src/aare/gui/new_gui/widgets/camera.py +++ b/src/aare/gui/new_gui/widgets/camera.py @@ -58,7 +58,6 @@ class CameraViewport(QWidget): self._beam_px: QPoint | None = None # beam centre, image-pixel coords self._beam_shutter = False self._beam_busy = False - self._focus: float | None = None self._detections: list = [] # raw boxes from prediction self._det_shape = None # [h, w] of the inference image self._show_detections = True @@ -255,10 +254,6 @@ class CameraViewport(QWidget): self._beam_busy = bool(busy) self.update() - def update_focus(self, value: float) -> None: - self._focus = value - self.update() - def update_predictions(self, payload: dict) -> None: if not isinstance(payload, dict): return @@ -473,8 +468,6 @@ class CameraViewport(QWidget): painter.setFont(f) fps = "-" if self._fps != self._fps else f"{self._fps:.0f}" # NaN-safe text = f"SAMCAM · {fps} fps · {self._zoom:.1f}×" - if self._focus is not None and self._focus == self._focus: # NaN-safe - text += f" · focus {self._focus:.0f}" painter.drawText(QRect(0, 8, r.width() - 14, 16), Qt.AlignRight | Qt.AlignTop, text)