Skip to content
1,856 changes: 1,066 additions & 790 deletions pixi.lock

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,15 @@ qtpy = ">=2.4.3,<3"
# Install the `gui` extra (bluesky-widgets, ntnda-qt-viewer, ...) in this env.
[feature.gui.pypi-dependencies]
hextools = { path = ".", editable = true, extras = ["gui"] }
ntnda-qt-viewer = { git = "https://github.com/jwlodek/ntnda-qt-viewer" }


[feature.gui.tasks]
qserver-gui = "queue-monitor --http-server-uri https://xf27id1-hex-qs1.nsls2.bnl.gov:443"
hex-gui = "python -m hextools.gui --http-server-uri https://xf27id1-hex-qs1.nsls2.bnl.gov:443"
hex-gui = "python -m hextools.gui"

[feature.gui-dev.tasks]
hex-gui-mock = "python -m hextools.gui --mock"

[environments]
# Base environments
Expand All @@ -113,6 +117,7 @@ terminal = {features = ["profile", "terminal"], solve-group = "profile"}
terminal-dev = { features = ["profile", "terminal", "dev"] }
qs = { features = ["profile", "qs"], solve-group = "profile" }
gui = { features = ["profile", "gui"], solve-group = "profile" }
gui-dev = { features = ["profile", "gui", "dev", "gui-dev"], solve-group = "profile" }

# Python version specific environments for CI
py311 = { features = ["dev", "py311"], solve-group = "py311" }
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ gui = [
"bluesky-queueserver",
"bluesky-queueserver-api",
"bluesky-httpserver",
"docstring-parser",
"tiled[client]",
"bluesky-tiled-plugins",
"matplotlib",
Expand Down Expand Up @@ -123,7 +124,7 @@ reportMissingImports = false # Ignore missing stubs in imported modules
addopts = """
--tb=native -vv --strict-markers --doctest-modules
--doctest-glob="*.rst" --doctest-glob="*.md"
--ignore=docs/examples --ignore=src/hextools/profiles
--ignore=docs/examples --ignore=src/hextools/profiles --ignore=src/hextools/gui
"""
# https://iscinumpy.gitlab.io/post/bound-version-constraints/#watch-for-warnings
filterwarnings = [
Expand Down
31 changes: 11 additions & 20 deletions src/hextools/edxd.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

from bluesky.preprocessors import finalize_wrapper, reset_positions_decorator
import numpy as np
from ophyd_async.core import StandardMovable

from hextools.detectors.germ import GeRMDetector
from hextools.photon_delivery_system import ensure_shutter_open, Shutter
from hextools.photon_delivery_system.shutter import ensure_shutter_closed
from hextools.utils import ensure_available
from hextools.motors import AsyncMovable, CollimatorTable, EDXDTable
from bluesky import plan_stubs as bps, plans as bp
from ophyd_async.epics.motor import Motor as AsyncEpicsMotor


def configure_test_pulses(
Expand Down Expand Up @@ -52,7 +54,7 @@ def edxd_count(


def edxd_scan(
motor: AsyncMovable[float],
motor: StandardMovable[float],
start: float,
stop: float,
num_points: int,
Expand Down Expand Up @@ -82,7 +84,7 @@ def _body():
if save_as_tiff:
germ.save_as_tiff()
else:
germ.save_as_hdf5()
germ.save_as_hdf()

_md = {
"plan_name": "edxd_scan",
Expand All @@ -100,23 +102,25 @@ def _cleanup():

return (
yield from bps.repeat(
yield from finalize_wrapper(_body(), _cleanup())),
finalize_wrapper(_body(), _cleanup()),
num=num_iterations,
delay=time_between_iterations
)
)


def edxd_grid_scan(
outer_motor: AsyncMovable[float],
outer_motor: StandardMovable[float],
outer_start: float,
outer_stop: float,
outer_num_steps: int,
inner_motor: AsyncMovable[float],
inner_motor: StandardMovable[float],
inner_start: float,
inner_stop: float,
inner_num_steps: int,
count_time: float,
snake: bool = False,
use_shutter: bool = True,
reset_position: bool = True,
description: str | None = None,
germ: GeRMDetector | None = None,
Expand All @@ -127,7 +131,7 @@ def edxd_grid_scan(
fe_shutter = ensure_available(Shutter, fe_shutter=fe_shutter)
photon_shutter = ensure_available(Shutter, photon_shutter=photon_shutter)
germ = ensure_available(GeRMDetector, germ=germ)
germ.save_as_hdf5()
germ.save_as_hdf()

def _body():
if use_shutter:
Expand All @@ -144,7 +148,7 @@ def _body():
outer_motor, outer_start, outer_stop, outer_num_steps,
inner_motor, inner_start, inner_stop, inner_num_steps,
md=_md,
snake=snake
snake_axes=snake
)

def _cleanup():
Expand All @@ -157,19 +161,6 @@ def _cleanup():

return (yield from finalize_wrapper(_body(), _cleanup()))

_md = {"plan_name": "edxd_grid_scan"}
if description is not None:
_md["description"] = description
yield from bp.grid_scan(
[germ],
outer_motor, outer_start, outer_stop, outer_num_steps,
inner_motor, inner_start, inner_stop, inner_num_steps,
md=_md,
snake=snake
)



def edxd_2theta_tilt(
theta: float,
move_out: bool = False,
Expand Down
Empty file added src/hextools/gui/__init__.py
Empty file.
Loading
Loading