Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an initial Qt-based tomography acquisition GUI to the IPython startup environment, integrating a live camera view (via qmicroscope) with basic RunEngine controls and simple alignment/workflow helpers.
Changes:
- Introduces a
TomoGUIMainWindowcombining a QMicroscope viewer, alignment controls, and RunEngine run/pause controls. - Adds simple motor move helpers and a placeholder “tomo workflow plan” driven by GUI-configurable start/end angles.
- Auto-creates a QApplication and a global
tomo_guiinstance during startup.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+6
to
+12
| from bluesky.utils import RunEngineInterrupted, install_qt_kicker | ||
| from matplotlib.backends.backend_qt5 import _create_qApp | ||
| from matplotlib.backends.qt_compat import QtCore, QtWidgets | ||
| from qmicroscope.microscope import Microscope | ||
| from qmicroscope.plugins import CrossHairPlugin | ||
|
|
||
| install_qt_kicker() |
startup/99-tomo_gui.py
Outdated
Comment on lines
+7
to
+10
| from matplotlib.backends.backend_qt5 import _create_qApp | ||
| from matplotlib.backends.qt_compat import QtCore, QtWidgets | ||
| from qmicroscope.microscope import Microscope | ||
| from qmicroscope.plugins import CrossHairPlugin |
Comment on lines
+40
to
+50
| def start_acquisition(self): | ||
| try: | ||
| self.microscope.acquire(True) | ||
| except Exception: | ||
| pass | ||
|
|
||
| def stop_acquisition(self): | ||
| try: | ||
| self.microscope.acquire(False) | ||
| except Exception: | ||
| pass |
Comment on lines
+297
to
+303
| motor = self._get_motor(self.active_tilt_motor_name) | ||
| if motor is None: | ||
| self._update_status(f"ss.{self.active_tilt_motor_name} is not available.") | ||
| return | ||
| self._run_re_plan(bps.mvr(motor, delta)) | ||
| self._update_status(f"Moved ss.{self.active_tilt_motor_name} by {delta}.") | ||
|
|
Comment on lines
+304
to
+310
| def move_translation(self, delta: float): | ||
| motor = self._get_motor(self.active_translation_motor_name) | ||
| if motor is None: | ||
| self._update_status(f"ss.{self.active_translation_motor_name} is not available.") | ||
| return | ||
| self._run_re_plan(bps.mvr(motor, delta)) | ||
| self._update_status(f"Moved ss.{self.active_translation_motor_name} by {delta}.") |
Comment on lines
+135
to
+139
| def __init__(self, RE): | ||
| super().__init__("Tomo Alignment Controls") | ||
| self.RE = RE | ||
| self.ss = globals().get("ss", None) | ||
|
|
Comment on lines
+293
to
+295
| self._run_re_plan(bps.mv(ry, target_angle)) | ||
| self._update_status(f"Moved ss.ry to {target_angle}.") | ||
|
|
Comment on lines
+371
to
+376
| class TOMOGUI: | ||
| def __init__(self): | ||
| existing_re = globals().get("RE", None) | ||
| self.RE = existing_re if existing_re is not None else RunEngine({}) | ||
| self.window = TomoGUIMainWindow(self.RE) | ||
|
|
startup/99-tomo_gui.py
Outdated
Comment on lines
+384
to
+391
| _create_qApp() | ||
|
|
||
| try: | ||
| tomo_gui.close() | ||
| except NameError: | ||
| pass | ||
|
|
||
| tomo_gui = TOMOGUI() |
Comment on lines
+1
to
+3
| from enum import Enum | ||
| from typing import Callable, Optional | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.