Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions src/hextools/gui/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
)
from hextools.tomography.radiography import take_radiograph
from hextools.utils import is_running_in_ci, reset_scan_id
from hextools.xrd import xrd_calibration, xrd_count, xrd_dark, xrd_scan

from ._event_loop import get_our_app_name, gui_qt
from ._threading import wait_for_workers_to_quit
Expand Down Expand Up @@ -351,16 +352,28 @@ def __init__(self, re_client: RunEngineClient | RunEngine, *args, **kwargs):


class QtXRDView(QWidget):
"""X-ray diffraction view: the live Perkin Elmer area detector viewer."""
"""X-ray diffraction view: the live Perkin Elmer viewer and XRD plans."""

def __init__(self, re_client: RunEngineClient | RunEngine, *args, **kwargs):
super().__init__(*args, **kwargs)
self._re_client = re_client

vbox = QVBoxLayout()
top = QHBoxLayout()
detectors = QtTabbedDetectorsWidget(re_client)
detectors.add_detector("perkin_elmer", "XF:27ID1-ES{PE-Det:1}")
vbox.addWidget(detectors, stretch=1)
top.addWidget(detectors, stretch=3)

plan_tabs = QTabWidget()
plan_tabs.addTab(QtPlanWidget(re_client, xrd_count), "Count")
plan_tabs.addTab(QtPlanWidget(re_client, xrd_scan), "Scan")
plan_tabs.addTab(QtPlanWidget(re_client, xrd_dark), "Dark")
plan_tabs.addTab(QtPlanWidget(re_client, xrd_calibration), "Calibration")
Comment thread
sligara7 marked this conversation as resolved.
side = QVBoxLayout()
side.addWidget(plan_tabs, stretch=1)
top.addLayout(side, stretch=1)

vbox = QVBoxLayout()
vbox.addLayout(top, stretch=1)
self.setLayout(vbox)


Expand Down
1 change: 1 addition & 0 deletions src/hextools/profiles/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
print_proposal_info,
print_version_info,
)
from hextools.xrd import *

# Adjust the default timeout for ophyd async to 60s
DEFAULT_TIMEOUT = 60.0
Expand Down
11 changes: 11 additions & 0 deletions src/hextools/xrd/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
"""X-Ray Diffraction (XRD) tools for HEX beamline."""

from .calibration import xrd_calibration
from .plans import ensure_cont_acq_exposure, xrd_count, xrd_dark, xrd_scan

__all__ = [
"xrd_calibration",
"xrd_count",
"xrd_dark",
"xrd_scan",
"ensure_cont_acq_exposure",
]
30 changes: 17 additions & 13 deletions src/hextools/xrd/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
from bluesky import Msg
from bluesky import plan_stubs as bps
from bluesky import plans as bp
from ophyd_async.epics.adcore import AreaDetector
from ophyd_async.epics.adcore import AreaDetector, ContAcqDetector
from ophyd_async.epics.adcore._io import ADBaseIOT
from ophyd_async.epics.motor import Motor as AsyncEpicsMotor

from hextools.photon_delivery_system import Shutter
from hextools.xrd.plans import ensure_cont_acq_exposure


def xrd_calibration(
Expand All @@ -26,17 +27,18 @@ def xrd_calibration(
if start_position is None:
start_position: float = yield from bps.rd(motor.user_readback)

yield from bps.abs_set(
detector.driver.acquire_time,
exposure_time,
detector.driver.acquire_period,
0.0,
detector.driver.num_images,
1,
wait=True,
)

try:
if isinstance(detector, ContAcqDetector):
yield from ensure_cont_acq_exposure(detector, exposure_time)
else:
yield from bps.mv(
detector.driver.acquire_time,
exposure_time,
detector.driver.acquire_period,
0.0,
detector.driver.num_images,
1,
)
yield from bps.mv(photon_shutter, True)

_md = {
Expand All @@ -52,5 +54,7 @@ def xrd_calibration(
md=_md,
)
finally:
yield from bps.mv(photon_shutter, False)
yield from bps.mv(motor, start_position)
try:
yield from bps.mv(photon_shutter, False)
finally:
yield from bps.mv(motor, start_position)
Loading
Loading