1 parent
c8cab28daf
commit
57738e98f8
4 files changed
+14
-8
No files matched your search
@@ -1,14 +1,12 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from typing import Any
|
||||
|
||||
from bec_lib.logger import bec_logger
|
||||
from bec_lib.messages import RawMessage
|
||||
from bec_widgets.utils.bec_connector import ConnectionConfig
|
||||
from bec_widgets.utils.bec_widget import BECWidget
|
||||
from PySide6.QtWidgets import QScrollArea, QVBoxLayout
|
||||
from qtpy.QtWidgets import QLabel, QWidget
|
||||
from qtpy.QtWidgets import QLabel, QScrollArea, QVBoxLayout, QWidget
|
||||
|
||||
logger = bec_logger.logger
|
||||
|
||||
@@ -19,6 +17,8 @@ def dicts_to_html_table(data: list[dict]) -> str:
|
||||
|
||||
# 1. Extract unique keys for the header
|
||||
headers = list(set(k for item in data for k in item.keys()))
|
||||
if "aaredb_params" in headers:
|
||||
headers.remove("aaredb_params")
|
||||
|
||||
# 2. Build the HTML Header Row
|
||||
html = "<table border='1'>\n <thead>\n <tr>\n"
|
||||
|
||||
@@ -10,6 +10,7 @@ from qtpy.QtWidgets import (
|
||||
QGridLayout,
|
||||
QGroupBox,
|
||||
QHBoxLayout,
|
||||
QLabel,
|
||||
QLineEdit,
|
||||
QPushButton,
|
||||
QScrollArea,
|
||||
@@ -20,6 +21,7 @@ from qtpy.QtWidgets import (
|
||||
|
||||
from mx_bec.endpoints import TaskEndpoints
|
||||
from mx_bec.messages import MXTaskExecutionMessage
|
||||
from mx_bec.tasks import MxTasks
|
||||
|
||||
logger = bec_logger.logger
|
||||
|
||||
@@ -133,6 +135,9 @@ class MxTaskPanel(BECWidget, QWidget):
|
||||
) -> QGroupBox:
|
||||
box = QGroupBox(task, parent=parent)
|
||||
form = QFormLayout()
|
||||
if (task_fn := getattr(MxTasks, task, None)) is not None:
|
||||
if (doc := task_fn.__doc__) is not None:
|
||||
form.addWidget(QLabel(doc))
|
||||
self._inputs[task] = {}
|
||||
for name, default in fields:
|
||||
widget = self._input(box, default)
|
||||
|
||||
+2
-2
@@ -55,9 +55,9 @@ class AareBec(BECClient):
|
||||
self.task_queue: MxTaskQueue | None = None
|
||||
self.sample_info: SampleInfo | None = None
|
||||
# HAX
|
||||
_host, _port = config_redis_url.split(":")
|
||||
_, _host, _port = config_redis_url.split(":")
|
||||
_port = int(_port)
|
||||
_hacky_redis = Redis(_host, _port)
|
||||
_hacky_redis = Redis(_host[2:], _port)
|
||||
self._spreadsheet = _hacky_redis.get("x10sa:sample_spreadsheet")
|
||||
_hacky_redis.close()
|
||||
|
||||
|
||||
+4
-3
@@ -182,10 +182,11 @@ class MxTasks:
|
||||
(`smargon_top_left` is left unset), optionally auto-centering afterwards."""
|
||||
smargon = self._client.devices.smargon
|
||||
smargon_top_left = smargon_top_left or SmargonCoordinate(
|
||||
sh_mm=Coordinate(x=smargon.x.get(), y=smargon.x.get(), z=smargon.x.get()),
|
||||
sh_mm=Coordinate(x=smargon.x.get(), y=smargon.y.get(), z=smargon.z.get()),
|
||||
chi_deg=smargon.chi.get(),
|
||||
phi_deg=smargon.phi.get(),
|
||||
)
|
||||
logger.info(f"smargon top left supplied to grid scan {smargon_top_left=}")
|
||||
request = RasterGridRequest(
|
||||
n_x=n_x,
|
||||
n_y=n_y,
|
||||
@@ -213,7 +214,7 @@ class MxTasks:
|
||||
dtz: float | None = None,
|
||||
) -> None:
|
||||
"""Run multiple raster scans at different omega values"""
|
||||
omegas = [float(ang) for ang in omegas_deg_list.split(",")]
|
||||
omegas = [float(ang.strip()) for ang in omegas_deg_list.split(",")]
|
||||
smargon = self._client.devices.smargon
|
||||
smargon_top_left = SmargonCoordinate(
|
||||
sh_mm=Coordinate(x=smargon.x.get(), y=smargon.x.get(), z=smargon.x.get()),
|
||||
@@ -227,7 +228,7 @@ class MxTasks:
|
||||
step_x_mm,
|
||||
step_y_mm,
|
||||
exp_time_s,
|
||||
file_prefix=f"{file_prefix}_{i}_{omega:%.2f}deg",
|
||||
file_prefix=f"{file_prefix}_{i}_{omega:.2f}deg",
|
||||
dtz=dtz,
|
||||
smargon_top_left=smargon_top_left,
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user