Skip to content

Added initial GUI implementation#19

Open
vshekar wants to merge 3 commits intoNSLS2:masterfrom
vshekar:tomo-gui
Open

Added initial GUI implementation#19
vshekar wants to merge 3 commits intoNSLS2:masterfrom
vshekar:tomo-gui

Conversation

@vshekar
Copy link
Copy Markdown

@vshekar vshekar commented Mar 16, 2026

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 TomoGUIMainWindow combining 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_gui instance 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()
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)

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants