diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml
index 4cf457f..508accf 100644
--- a/.gitea/workflows/ci.yml
+++ b/.gitea/workflows/ci.yml
@@ -24,6 +24,11 @@ on:
required: false
type: string
default: "main"
+ MX_BEC_REPO_BRANCH:
+ description: "Branch of the mx_bec core repo to install"
+ required: false
+ type: string
+ default: "main"
PYTHON_VERSION:
description: "Python version to use"
required: false
@@ -46,6 +51,29 @@ jobs:
with:
python-version: "${{ inputs.PYTHON_VERSION || '3.12' }}"
+ # Use the same-named branch of mx_bec if it exists (e.g. a feature developed in both repos), otherwise main.
+ - name: Resolve mx_bec branch
+ id: mx_bec
+ shell: bash
+ run: |
+ ref="${{ inputs.MX_BEC_REPO_BRANCH || github.head_ref || github.ref_name }}"
+ auth="$(printf 'x-access-token:%s' '${{ github.token }}' | base64 -w0)"
+ if git -c "http.extraheader=Authorization: Basic ${auth}" ls-remote --exit-code --heads \
+ "${{ github.server_url }}/bec/mx_bec.git" "refs/heads/${ref}" >/dev/null; then
+ echo "Using mx_bec branch '${ref}'"
+ else
+ echo "mx_bec has no branch '${ref}', using main"
+ ref=main
+ fi
+ echo "ref=${ref}" >> "$GITHUB_OUTPUT"
+
+ - name: Checkout MX BEC Repository
+ uses: actions/checkout@v4
+ with:
+ repository: bec/mx_bec
+ ref: "${{ steps.mx_bec.outputs.ref }}"
+ path: ./mx_bec
+
- name: Checkout BEC Plugin Repository
uses: actions/checkout@v4
with:
@@ -94,8 +122,10 @@ jobs:
uv pip install --system -e ./bec/bec_lib[dev]
uv pip install --system -e ./bec/bec_ipython_client
uv pip install --system -e ./bec/bec_server[dev]
- uv pip install --system -e ./bec_widgets[dev,pyside6]
- uv pip install --system -e ./pxii_bec[dev]
+ uv pip install --system -e ./bec_widgets[dev]
+ # MX-internal dependencies (aarecommon, aare_config, jfjoch_client, ...) come from gitea
+ uv pip install --system --extra-index-url https://gitea.psi.ch/api/packages/mx/pypi/simple/ -e ./mx_bec[dev]
+ uv pip install --system --extra-index-url https://gitea.psi.ch/api/packages/mx/pypi/simple/ -e ./pxii_bec[dev]
- name: Run Tests with Coverage
id: coverage
diff --git a/pxii_bec/bec_widgets/widgets/__init__.py b/pxii_bec/bec_widgets/widgets/__init__.py
index e69de29..562ce61 100644
--- a/pxii_bec/bec_widgets/widgets/__init__.py
+++ b/pxii_bec/bec_widgets/widgets/__init__.py
@@ -0,0 +1,5 @@
+from mx_bec.bec_widgets.widgets.aare_bec.actors_config import MxActorConfigWidget
+from mx_bec.bec_widgets.widgets.aare_bec.task_panel import MxTaskPanel
+from mx_bec.bec_widgets.widgets.aare_bec.task_queue import MxTaskQueueWidget
+
+__all__ = ["MxActorConfigWidget", "MxTaskPanel", "MxTaskQueueWidget"]
diff --git a/pxii_bec/bec_widgets/widgets/client.py b/pxii_bec/bec_widgets/widgets/client.py
index 3d1e02c..ec1bfbc 100644
--- a/pxii_bec/bec_widgets/widgets/client.py
+++ b/pxii_bec/bec_widgets/widgets/client.py
@@ -13,10 +13,89 @@ logger = bec_logger.logger
_Widgets = {
+ "PxIIActorConfigWiget": "PxIIActorConfigWiget",
+ "PxIISampleQueueWidget": "PxIISampleQueueWidget",
+ "PxIISpreadsheetDisplay": "PxIISpreadsheetDisplay",
+ "PxIITaskPanel": "PxIITaskPanel",
+ "PxIITaskQueueWidget": "PxIITaskQueueWidget",
"ScanHistory": "ScanHistory",
}
+class PxIIActorConfigWiget(RPCBase):
+ _IMPORT_MODULE = "pxii_bec.bec_widgets.widgets.imported"
+
+ @rpc_call
+ def refresh(self):
+ """
+ Reset the layout for currently loaded actors
+ """
+
+
+class PxIISampleQueueWidget(RPCBase):
+ _IMPORT_MODULE = "pxii_bec.bec_widgets.widgets.imported"
+
+ @rpc_call
+ def refresh(self):
+ """
+ Reload the queued samples from Redis.
+ """
+
+ @rpc_call
+ def clear_queue(self):
+ """
+ Delete the queue contents
+ """
+
+
+class PxIISpreadsheetDisplay(RPCBase):
+ _IMPORT_MODULE = "pxii_bec.bec_widgets.widgets.imported"
+
+ @rpc_call
+ def remove(self):
+ """
+ Cleanup the BECConnector
+ """
+
+ @rpc_call
+ def attach(self):
+ """
+ None
+ """
+
+ @rpc_call
+ def detach(self):
+ """
+ Detach the widget from its parent dock widget (if widget is in the dock), making it a floating widget.
+ """
+
+
+class PxIITaskPanel(RPCBase):
+ _IMPORT_MODULE = "pxii_bec.bec_widgets.widgets.imported"
+
+ @rpc_call
+ def request_task(self, name: "str", *args, **kwargs):
+ """
+ Submit a task request to the AareBec service.
+ """
+
+
+class PxIITaskQueueWidget(RPCBase):
+ _IMPORT_MODULE = "pxii_bec.bec_widgets.widgets.imported"
+
+ @rpc_call
+ def refresh(self):
+ """
+ Reload the queued tasks from Redis.
+ """
+
+ @rpc_call
+ def clear_queue(self):
+ """
+ Delete the queue contents
+ """
+
+
class ScanHistory(RPCBase):
_IMPORT_MODULE = "pxii_bec.bec_widgets.widgets.scan_history.scan_history"
diff --git a/pxii_bec/bec_widgets/widgets/designer_plugins.py b/pxii_bec/bec_widgets/widgets/designer_plugins.py
index e80b774..c19874e 100644
--- a/pxii_bec/bec_widgets/widgets/designer_plugins.py
+++ b/pxii_bec/bec_widgets/widgets/designer_plugins.py
@@ -5,9 +5,19 @@ from __future__ import annotations
# pylint: skip-file
designer_plugins = {
+ "PxIIActorConfigWiget": ("pxii_bec.bec_widgets.widgets.imported", "PxIIActorConfigWiget"),
+ "PxIISampleQueueWidget": ("pxii_bec.bec_widgets.widgets.imported", "PxIISampleQueueWidget"),
+ "PxIISpreadsheetDisplay": ("pxii_bec.bec_widgets.widgets.imported", "PxIISpreadsheetDisplay"),
+ "PxIITaskPanel": ("pxii_bec.bec_widgets.widgets.imported", "PxIITaskPanel"),
+ "PxIITaskQueueWidget": ("pxii_bec.bec_widgets.widgets.imported", "PxIITaskQueueWidget"),
"ScanHistory": ("pxii_bec.bec_widgets.widgets.scan_history.scan_history", "ScanHistory"),
}
widget_icons = {
+ "PxIIActorConfigWiget": "format_list_bulleted",
+ "PxIISampleQueueWidget": "pending_actions",
+ "PxIISpreadsheetDisplay": "format_list_bulleted",
+ "PxIITaskPanel": "play_arrow",
+ "PxIITaskQueueWidget": "pending_actions",
"ScanHistory": "widgets",
}
diff --git a/pxii_bec/bec_widgets/widgets/imported.py b/pxii_bec/bec_widgets/widgets/imported.py
new file mode 100644
index 0000000..59cb071
--- /dev/null
+++ b/pxii_bec/bec_widgets/widgets/imported.py
@@ -0,0 +1,22 @@
+from mx_bec.bec_widgets.widgets.aare_bec import (
+ MxActorConfigWidget,
+ MxTaskPanel,
+ MxTaskQueueWidget,
+ SampleQueueWidget,
+ SampleSpreadsheetDisplay,
+)
+
+
+class PxIIActorConfigWiget(MxActorConfigWidget): ...
+
+
+class PxIITaskQueueWidget(MxTaskQueueWidget): ...
+
+
+class PxIISampleQueueWidget(SampleQueueWidget): ...
+
+
+class PxIITaskPanel(MxTaskPanel): ...
+
+
+class PxIISpreadsheetDisplay(SampleSpreadsheetDisplay): ...
diff --git a/pxii_bec/bec_widgets/widgets/px_ii_actor_config_wiget.pyproject b/pxii_bec/bec_widgets/widgets/px_ii_actor_config_wiget.pyproject
new file mode 100644
index 0000000..4cbb48d
--- /dev/null
+++ b/pxii_bec/bec_widgets/widgets/px_ii_actor_config_wiget.pyproject
@@ -0,0 +1 @@
+{'files': ['imported.py']}
\ No newline at end of file
diff --git a/pxii_bec/bec_widgets/widgets/px_ii_actor_config_wiget_plugin.py b/pxii_bec/bec_widgets/widgets/px_ii_actor_config_wiget_plugin.py
new file mode 100644
index 0000000..51b6960
--- /dev/null
+++ b/pxii_bec/bec_widgets/widgets/px_ii_actor_config_wiget_plugin.py
@@ -0,0 +1,57 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+from qtpy.QtDesigner import QDesignerCustomWidgetInterface
+from qtpy.QtWidgets import QWidget
+
+from bec_widgets.utils.bec_designer import designer_material_icon
+from pxii_bec.bec_widgets.widgets.imported import PxIIActorConfigWiget
+
+DOM_XML = """
+
+
+
+
+"""
+
+
+class PxIIActorConfigWigetPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
+ def __init__(self):
+ super().__init__()
+ self._form_editor = None
+
+ def createWidget(self, parent):
+ if parent is None:
+ return QWidget()
+ t = PxIIActorConfigWiget(parent)
+ return t
+
+ def domXml(self):
+ return DOM_XML
+
+ def group(self):
+ return ""
+
+ def icon(self):
+ return designer_material_icon(PxIIActorConfigWiget.ICON_NAME)
+
+ def includeFile(self):
+ return "px_ii_actor_config_wiget"
+
+ def initialize(self, form_editor):
+ self._form_editor = form_editor
+
+ def isContainer(self):
+ return False
+
+ def isInitialized(self):
+ return self._form_editor is not None
+
+ def name(self):
+ return "PxIIActorConfigWiget"
+
+ def toolTip(self):
+ return "PxIIActorConfigWiget"
+
+ def whatsThis(self):
+ return self.toolTip()
diff --git a/pxii_bec/bec_widgets/widgets/px_ii_sample_queue_widget.pyproject b/pxii_bec/bec_widgets/widgets/px_ii_sample_queue_widget.pyproject
new file mode 100644
index 0000000..4cbb48d
--- /dev/null
+++ b/pxii_bec/bec_widgets/widgets/px_ii_sample_queue_widget.pyproject
@@ -0,0 +1 @@
+{'files': ['imported.py']}
\ No newline at end of file
diff --git a/pxii_bec/bec_widgets/widgets/px_ii_sample_queue_widget_plugin.py b/pxii_bec/bec_widgets/widgets/px_ii_sample_queue_widget_plugin.py
new file mode 100644
index 0000000..8868fa0
--- /dev/null
+++ b/pxii_bec/bec_widgets/widgets/px_ii_sample_queue_widget_plugin.py
@@ -0,0 +1,57 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+from qtpy.QtDesigner import QDesignerCustomWidgetInterface
+from qtpy.QtWidgets import QWidget
+
+from bec_widgets.utils.bec_designer import designer_material_icon
+from pxii_bec.bec_widgets.widgets.imported import PxIISampleQueueWidget
+
+DOM_XML = """
+
+
+
+
+"""
+
+
+class PxIISampleQueueWidgetPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
+ def __init__(self):
+ super().__init__()
+ self._form_editor = None
+
+ def createWidget(self, parent):
+ if parent is None:
+ return QWidget()
+ t = PxIISampleQueueWidget(parent)
+ return t
+
+ def domXml(self):
+ return DOM_XML
+
+ def group(self):
+ return ""
+
+ def icon(self):
+ return designer_material_icon(PxIISampleQueueWidget.ICON_NAME)
+
+ def includeFile(self):
+ return "px_ii_sample_queue_widget"
+
+ def initialize(self, form_editor):
+ self._form_editor = form_editor
+
+ def isContainer(self):
+ return False
+
+ def isInitialized(self):
+ return self._form_editor is not None
+
+ def name(self):
+ return "PxIISampleQueueWidget"
+
+ def toolTip(self):
+ return "PxIISampleQueueWidget"
+
+ def whatsThis(self):
+ return self.toolTip()
diff --git a/pxii_bec/bec_widgets/widgets/px_ii_spreadsheet_display.pyproject b/pxii_bec/bec_widgets/widgets/px_ii_spreadsheet_display.pyproject
new file mode 100644
index 0000000..4cbb48d
--- /dev/null
+++ b/pxii_bec/bec_widgets/widgets/px_ii_spreadsheet_display.pyproject
@@ -0,0 +1 @@
+{'files': ['imported.py']}
\ No newline at end of file
diff --git a/pxii_bec/bec_widgets/widgets/px_ii_spreadsheet_display_plugin.py b/pxii_bec/bec_widgets/widgets/px_ii_spreadsheet_display_plugin.py
new file mode 100644
index 0000000..3a8323a
--- /dev/null
+++ b/pxii_bec/bec_widgets/widgets/px_ii_spreadsheet_display_plugin.py
@@ -0,0 +1,57 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+from qtpy.QtDesigner import QDesignerCustomWidgetInterface
+from qtpy.QtWidgets import QWidget
+
+from bec_widgets.utils.bec_designer import designer_material_icon
+from pxii_bec.bec_widgets.widgets.imported import PxIISpreadsheetDisplay
+
+DOM_XML = """
+
+
+
+
+"""
+
+
+class PxIISpreadsheetDisplayPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
+ def __init__(self):
+ super().__init__()
+ self._form_editor = None
+
+ def createWidget(self, parent):
+ if parent is None:
+ return QWidget()
+ t = PxIISpreadsheetDisplay(parent)
+ return t
+
+ def domXml(self):
+ return DOM_XML
+
+ def group(self):
+ return ""
+
+ def icon(self):
+ return designer_material_icon(PxIISpreadsheetDisplay.ICON_NAME)
+
+ def includeFile(self):
+ return "px_ii_spreadsheet_display"
+
+ def initialize(self, form_editor):
+ self._form_editor = form_editor
+
+ def isContainer(self):
+ return False
+
+ def isInitialized(self):
+ return self._form_editor is not None
+
+ def name(self):
+ return "PxIISpreadsheetDisplay"
+
+ def toolTip(self):
+ return "PxIISpreadsheetDisplay"
+
+ def whatsThis(self):
+ return self.toolTip()
diff --git a/pxii_bec/bec_widgets/widgets/px_ii_task_panel.pyproject b/pxii_bec/bec_widgets/widgets/px_ii_task_panel.pyproject
new file mode 100644
index 0000000..4cbb48d
--- /dev/null
+++ b/pxii_bec/bec_widgets/widgets/px_ii_task_panel.pyproject
@@ -0,0 +1 @@
+{'files': ['imported.py']}
\ No newline at end of file
diff --git a/pxii_bec/bec_widgets/widgets/px_ii_task_panel_plugin.py b/pxii_bec/bec_widgets/widgets/px_ii_task_panel_plugin.py
new file mode 100644
index 0000000..ccbeadf
--- /dev/null
+++ b/pxii_bec/bec_widgets/widgets/px_ii_task_panel_plugin.py
@@ -0,0 +1,57 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+from qtpy.QtDesigner import QDesignerCustomWidgetInterface
+from qtpy.QtWidgets import QWidget
+
+from bec_widgets.utils.bec_designer import designer_material_icon
+from pxii_bec.bec_widgets.widgets.imported import PxIITaskPanel
+
+DOM_XML = """
+
+
+
+
+"""
+
+
+class PxIITaskPanelPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
+ def __init__(self):
+ super().__init__()
+ self._form_editor = None
+
+ def createWidget(self, parent):
+ if parent is None:
+ return QWidget()
+ t = PxIITaskPanel(parent)
+ return t
+
+ def domXml(self):
+ return DOM_XML
+
+ def group(self):
+ return ""
+
+ def icon(self):
+ return designer_material_icon(PxIITaskPanel.ICON_NAME)
+
+ def includeFile(self):
+ return "px_ii_task_panel"
+
+ def initialize(self, form_editor):
+ self._form_editor = form_editor
+
+ def isContainer(self):
+ return False
+
+ def isInitialized(self):
+ return self._form_editor is not None
+
+ def name(self):
+ return "PxIITaskPanel"
+
+ def toolTip(self):
+ return "PxIITaskPanel"
+
+ def whatsThis(self):
+ return self.toolTip()
diff --git a/pxii_bec/bec_widgets/widgets/px_ii_task_queue_widget.pyproject b/pxii_bec/bec_widgets/widgets/px_ii_task_queue_widget.pyproject
new file mode 100644
index 0000000..4cbb48d
--- /dev/null
+++ b/pxii_bec/bec_widgets/widgets/px_ii_task_queue_widget.pyproject
@@ -0,0 +1 @@
+{'files': ['imported.py']}
\ No newline at end of file
diff --git a/pxii_bec/bec_widgets/widgets/px_ii_task_queue_widget_plugin.py b/pxii_bec/bec_widgets/widgets/px_ii_task_queue_widget_plugin.py
new file mode 100644
index 0000000..52f293e
--- /dev/null
+++ b/pxii_bec/bec_widgets/widgets/px_ii_task_queue_widget_plugin.py
@@ -0,0 +1,57 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+from qtpy.QtDesigner import QDesignerCustomWidgetInterface
+from qtpy.QtWidgets import QWidget
+
+from bec_widgets.utils.bec_designer import designer_material_icon
+from pxii_bec.bec_widgets.widgets.imported import PxIITaskQueueWidget
+
+DOM_XML = """
+
+
+
+
+"""
+
+
+class PxIITaskQueueWidgetPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
+ def __init__(self):
+ super().__init__()
+ self._form_editor = None
+
+ def createWidget(self, parent):
+ if parent is None:
+ return QWidget()
+ t = PxIITaskQueueWidget(parent)
+ return t
+
+ def domXml(self):
+ return DOM_XML
+
+ def group(self):
+ return ""
+
+ def icon(self):
+ return designer_material_icon(PxIITaskQueueWidget.ICON_NAME)
+
+ def includeFile(self):
+ return "px_ii_task_queue_widget"
+
+ def initialize(self, form_editor):
+ self._form_editor = form_editor
+
+ def isContainer(self):
+ return False
+
+ def isInitialized(self):
+ return self._form_editor is not None
+
+ def name(self):
+ return "PxIITaskQueueWidget"
+
+ def toolTip(self):
+ return "PxIITaskQueueWidget"
+
+ def whatsThis(self):
+ return self.toolTip()
diff --git a/pxii_bec/bec_widgets/widgets/register_px_ii_actor_config_wiget.py b/pxii_bec/bec_widgets/widgets/register_px_ii_actor_config_wiget.py
new file mode 100644
index 0000000..00744c0
--- /dev/null
+++ b/pxii_bec/bec_widgets/widgets/register_px_ii_actor_config_wiget.py
@@ -0,0 +1,15 @@
+def main(): # pragma: no cover
+ from qtpy import PYSIDE6
+
+ if not PYSIDE6:
+ print("PYSIDE6 is not available in the environment. Cannot patch designer.")
+ return
+ from PySide6.QtDesigner import QPyDesignerCustomWidgetCollection
+
+ from pxii_bec.bec_widgets.widgets.px_ii_actor_config_wiget_plugin import PxIIActorConfigWigetPlugin
+
+ QPyDesignerCustomWidgetCollection.addCustomWidget(PxIIActorConfigWigetPlugin())
+
+
+if __name__ == "__main__": # pragma: no cover
+ main()
diff --git a/pxii_bec/bec_widgets/widgets/register_px_ii_sample_queue_widget.py b/pxii_bec/bec_widgets/widgets/register_px_ii_sample_queue_widget.py
new file mode 100644
index 0000000..effa8d7
--- /dev/null
+++ b/pxii_bec/bec_widgets/widgets/register_px_ii_sample_queue_widget.py
@@ -0,0 +1,15 @@
+def main(): # pragma: no cover
+ from qtpy import PYSIDE6
+
+ if not PYSIDE6:
+ print("PYSIDE6 is not available in the environment. Cannot patch designer.")
+ return
+ from PySide6.QtDesigner import QPyDesignerCustomWidgetCollection
+
+ from pxii_bec.bec_widgets.widgets.px_ii_sample_queue_widget_plugin import PxIISampleQueueWidgetPlugin
+
+ QPyDesignerCustomWidgetCollection.addCustomWidget(PxIISampleQueueWidgetPlugin())
+
+
+if __name__ == "__main__": # pragma: no cover
+ main()
diff --git a/pxii_bec/bec_widgets/widgets/register_px_ii_spreadsheet_display.py b/pxii_bec/bec_widgets/widgets/register_px_ii_spreadsheet_display.py
new file mode 100644
index 0000000..f47b096
--- /dev/null
+++ b/pxii_bec/bec_widgets/widgets/register_px_ii_spreadsheet_display.py
@@ -0,0 +1,15 @@
+def main(): # pragma: no cover
+ from qtpy import PYSIDE6
+
+ if not PYSIDE6:
+ print("PYSIDE6 is not available in the environment. Cannot patch designer.")
+ return
+ from PySide6.QtDesigner import QPyDesignerCustomWidgetCollection
+
+ from pxii_bec.bec_widgets.widgets.px_ii_spreadsheet_display_plugin import PxIISpreadsheetDisplayPlugin
+
+ QPyDesignerCustomWidgetCollection.addCustomWidget(PxIISpreadsheetDisplayPlugin())
+
+
+if __name__ == "__main__": # pragma: no cover
+ main()
diff --git a/pxii_bec/bec_widgets/widgets/register_px_ii_task_panel.py b/pxii_bec/bec_widgets/widgets/register_px_ii_task_panel.py
new file mode 100644
index 0000000..e0b4e2b
--- /dev/null
+++ b/pxii_bec/bec_widgets/widgets/register_px_ii_task_panel.py
@@ -0,0 +1,15 @@
+def main(): # pragma: no cover
+ from qtpy import PYSIDE6
+
+ if not PYSIDE6:
+ print("PYSIDE6 is not available in the environment. Cannot patch designer.")
+ return
+ from PySide6.QtDesigner import QPyDesignerCustomWidgetCollection
+
+ from pxii_bec.bec_widgets.widgets.px_ii_task_panel_plugin import PxIITaskPanelPlugin
+
+ QPyDesignerCustomWidgetCollection.addCustomWidget(PxIITaskPanelPlugin())
+
+
+if __name__ == "__main__": # pragma: no cover
+ main()
diff --git a/pxii_bec/bec_widgets/widgets/register_px_ii_task_queue_widget.py b/pxii_bec/bec_widgets/widgets/register_px_ii_task_queue_widget.py
new file mode 100644
index 0000000..8e94f05
--- /dev/null
+++ b/pxii_bec/bec_widgets/widgets/register_px_ii_task_queue_widget.py
@@ -0,0 +1,15 @@
+def main(): # pragma: no cover
+ from qtpy import PYSIDE6
+
+ if not PYSIDE6:
+ print("PYSIDE6 is not available in the environment. Cannot patch designer.")
+ return
+ from PySide6.QtDesigner import QPyDesignerCustomWidgetCollection
+
+ from pxii_bec.bec_widgets.widgets.px_ii_task_queue_widget_plugin import PxIITaskQueueWidgetPlugin
+
+ QPyDesignerCustomWidgetCollection.addCustomWidget(PxIITaskQueueWidgetPlugin())
+
+
+if __name__ == "__main__": # pragma: no cover
+ main()
diff --git a/pxii_bec/device_configs/pxii-devices.yaml b/pxii_bec/device_configs/pxii-devices.yaml
index d653a2e..50fe646 100755
--- a/pxii_bec/device_configs/pxii-devices.yaml
+++ b/pxii_bec/device_configs/pxii-devices.yaml
@@ -21,7 +21,6 @@
# Default values may be omitted for brevity.
##########################################################################################################################
-
# An example device configuration with all fields:
# device1:
@@ -30,7 +29,7 @@
# deviceConfig:
# delay: 1
# update_frequency: 10
-# deviceTags:
+# deviceTags:
# - frontend
# - motor
# enabled: true
@@ -48,15 +47,18 @@
##########################################################################################################################
-
aerotech:
description: REST-based device which connects to AareScan and Aerotech
- deviceClass: pxii_bec.devices.aerotech.Aerotech
+ deviceClass: pxii_bec.devices.Aerotech
deviceConfig:
prefix: http://mx-x10sa-queue-01:5234
+ vel_u_deg_s: 30
+ vel_x_mm_s: 0.1
+ vel_y_mm_s: 0.1
+ vel_z_mm_s: 0.1
deviceTags:
- - aerotech
- - motors
+ - aerotech
+ - motors
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -81,7 +83,7 @@ bcu_bpm1:
auto_monitor: true
read_pv: X10SA-ES-BCBPM:Current1:MeanValue_RBV
deviceTags:
- - bpm
+ - bpm
enabled: true
onFailure: buffer
readOnly: true
@@ -93,7 +95,7 @@ bcu_bpm2:
auto_monitor: true
read_pv: X10SA-ES-BCBPM:Current2:MeanValue_RBV
deviceTags:
- - bpm
+ - bpm
enabled: true
onFailure: buffer
readOnly: true
@@ -105,7 +107,7 @@ bcu_bpm3:
auto_monitor: true
read_pv: X10SA-ES-BCBPM:Current3:MeanValue_RBV
deviceTags:
- - bpm
+ - bpm
enabled: true
onFailure: buffer
readOnly: true
@@ -117,7 +119,7 @@ bcu_bpm4:
auto_monitor: true
read_pv: X10SA-ES-BCBPM:Current4:MeanValue_RBV
deviceTags:
- - bpm
+ - bpm
enabled: true
onFailure: buffer
readOnly: true
@@ -128,7 +130,7 @@ bcu_bpm_x:
deviceConfig:
prefix: X10SA-ES-BCBPM:TRX
deviceTags:
- - bcu
+ - bcu
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -138,7 +140,7 @@ bcu_bpm_y:
deviceConfig:
prefix: X10SA-ES-BCBPM:TRY
deviceTags:
- - bcu
+ - bcu
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -149,7 +151,7 @@ bcu_bpmsum:
auto_monitor: true
read_pv: X10SA-ES-BCBPM:SumAll:MeanValue_RBV
deviceTags:
- - bpm
+ - bpm
enabled: true
onFailure: buffer
readOnly: true
@@ -161,7 +163,7 @@ bcu_shutter:
auto_monitor: true
read_pv: X10SA-ES-SHUTTER:SET
deviceTags:
- - state
+ - state
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -171,7 +173,7 @@ bcu_sl_xcen:
deviceConfig:
prefix: X10SA-ES-BCSLH:CENTER
deviceTags:
- - bcu
+ - bcu
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -181,7 +183,7 @@ bcu_sl_xr:
deviceConfig:
prefix: X10SA-ES-BCSLH:TRXR
deviceTags:
- - bcu
+ - bcu
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -191,7 +193,7 @@ bcu_sl_xsize:
deviceConfig:
prefix: X10SA-ES-BCSLH:SIZE
deviceTags:
- - bcu
+ - bcu
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -201,7 +203,7 @@ bcu_sl_xw:
deviceConfig:
prefix: X10SA-ES-BCSLH:TRXW
deviceTags:
- - bcu
+ - bcu
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -211,7 +213,7 @@ bcu_sl_yb:
deviceConfig:
prefix: X10SA-ES-BCSLV:TRYB
deviceTags:
- - bcu
+ - bcu
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -221,7 +223,7 @@ bcu_sl_ycen:
deviceConfig:
prefix: X10SA-ES-BCSLV:CENTER
deviceTags:
- - bcu
+ - bcu
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -231,7 +233,7 @@ bcu_sl_ysize:
deviceConfig:
prefix: X10SA-ES-BCSLV:SIZE
deviceTags:
- - bcu
+ - bcu
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -241,7 +243,7 @@ bcu_sl_yt:
deviceConfig:
prefix: X10SA-ES-BCSLV:TRYT
deviceTags:
- - bcu
+ - bcu
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -252,13 +254,13 @@ bl_bright:
auto_monitor: true
read_pv: X10SA-ES-BL:SET
deviceTags:
- - state
+ - state
enabled: true
onFailure: buffer
readoutPriority: baseline
userParameter:
- 'off': 0.0
- 'on': 1.3
+ "off": 0.0
+ "on": 1.3
tol: 0.01
type: continuous
bl_pos:
@@ -268,7 +270,7 @@ bl_pos:
auto_monitor: true
read_pv: X10SA-ES-BL:POS-SET
deviceTags:
- - state
+ - state
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -283,7 +285,7 @@ bs_pos:
auto_monitor: true
read_pv: X10SA-ES-BS:POS-SET
deviceTags:
- - state
+ - state
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -297,7 +299,7 @@ bs_x:
deviceConfig:
prefix: X10SA-ES-BS:TRX
deviceTags:
- - se
+ - se
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -309,7 +311,7 @@ bs_y:
deviceConfig:
prefix: X10SA-ES-BS:TRY
deviceTags:
- - se
+ - se
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -321,7 +323,7 @@ bs_z:
deviceConfig:
prefix: X10SA-ES-BS:TRZ
deviceTags:
- - state
+ - state
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -339,7 +341,7 @@ bsf_f1_y:
deviceConfig:
prefix: X10SA-OP-BSFFI1:TRY
deviceTags:
- - bsf
+ - bsf
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -349,7 +351,7 @@ bsf_f2_y:
deviceConfig:
prefix: X10SA-OP-BSFFI2:TRY
deviceTags:
- - bsf
+ - bsf
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -359,7 +361,7 @@ bsf_sl_xcen:
deviceConfig:
prefix: X10SA-OP-BSFSLH:CENTER
deviceTags:
- - bsf
+ - bsf
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -369,7 +371,7 @@ bsf_sl_xr:
deviceConfig:
prefix: X10SA-OP-BSFSLH:TRXR
deviceTags:
- - bsf
+ - bsf
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -379,7 +381,7 @@ bsf_sl_xsize:
deviceConfig:
prefix: X10SA-OP-BSFSLH:SIZE
deviceTags:
- - bsf
+ - bsf
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -389,7 +391,7 @@ bsf_sl_xw:
deviceConfig:
prefix: X10SA-OP-BSFSLH:TRXW
deviceTags:
- - bsf
+ - bsf
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -399,7 +401,7 @@ bsf_sl_yb:
deviceConfig:
prefix: X10SA-OP-BSFSLV:TRYB
deviceTags:
- - bsf
+ - bsf
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -409,7 +411,7 @@ bsf_sl_ycen:
deviceConfig:
prefix: X10SA-OP-BSFSLV:CENTER
deviceTags:
- - bsf
+ - bsf
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -419,7 +421,7 @@ bsf_sl_ysize:
deviceConfig:
prefix: X10SA-OP-BSFSLV:SIZE
deviceTags:
- - bsf
+ - bsf
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -429,7 +431,7 @@ bsf_sl_yt:
deviceConfig:
prefix: X10SA-OP-BSFSLV:TRYT
deviceTags:
- - bsf
+ - bsf
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -439,7 +441,7 @@ coll_x:
deviceConfig:
prefix: X10SA-ES-COL:TRX
deviceTags:
- - se
+ - se
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -451,7 +453,7 @@ coll_y:
deviceConfig:
prefix: X10SA-ES-COL:TRY
deviceTags:
- - state
+ - state
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -469,7 +471,7 @@ coll_y_in_position:
auto_monitor: true
read_pv: X10SA-ES-COL:POS-SET-SEQ.DO2
deviceTags:
- - se
+ - se
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -480,7 +482,7 @@ cryo_pos:
auto_monitor: true
read_pv: X10SA-ES-CS:POS-SET
deviceTags:
- - state
+ - state
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -495,7 +497,7 @@ cryo_temp:
auto_monitor: true
read_pv: X10SA-ES-CS:TEMP_RBV
deviceTags:
- - se
+ - se
enabled: true
onFailure: buffer
readOnly: true
@@ -506,7 +508,7 @@ cryo_x:
deviceConfig:
prefix: X10SA-ES-CS:TRX
deviceTags:
- - se
+ - se
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -516,7 +518,7 @@ dcm_bragg:
deviceConfig:
prefix: X10SA-OP-DCM:ROTY
deviceTags:
- - dcm
+ - dcm
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -526,7 +528,7 @@ dcm_fpitch:
deviceConfig:
prefix: X10SA-OP-DCM:ROTY-CR2-FINEPITCH
deviceTags:
- - dcm
+ - dcm
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -536,7 +538,7 @@ dcm_froll:
deviceConfig:
prefix: X10SA-OP-DCM:ROTZ-CR2-FINEROLL
deviceTags:
- - dcm
+ - dcm
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -546,7 +548,7 @@ dcm_perp:
deviceConfig:
prefix: X10SA-OP-DCM:TRX-CR2
deviceTags:
- - dcm
+ - dcm
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -556,7 +558,7 @@ dcm_pitch:
deviceConfig:
prefix: X10SA-OP-DCM:ROTY-CR2-PITCH
deviceTags:
- - dcm
+ - dcm
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -568,7 +570,7 @@ dcm_x:
deviceConfig:
prefix: X10SA-OP-DCM:TRX
deviceTags:
- - dcm
+ - dcm
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -579,7 +581,7 @@ det_cov:
auto_monitor: true
read_pv: X10SA-ES-DETCOV:SET
deviceTags:
- - state
+ - state
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -593,7 +595,7 @@ det_xi_focus:
deviceConfig:
prefix: X10SA-ES-XEYE:FOCUS
deviceTags:
- - det
+ - det
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -603,7 +605,7 @@ det_xi_x:
deviceConfig:
prefix: X10SA-ES-XEYE:TRX
deviceTags:
- - det
+ - det
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -613,7 +615,7 @@ det_xi_zoom:
deviceConfig:
prefix: X10SA-ES-XEYE:ZOOM
deviceTags:
- - det
+ - det
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -623,7 +625,7 @@ det_y:
deviceConfig:
prefix: X10SA-ES-DET:TRY
deviceTags:
- - det
+ - det
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -636,7 +638,7 @@ det_z:
deviceConfig:
prefix: X10SA-ES-DET:TRZ
deviceTags:
- - det
+ - det
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -649,7 +651,7 @@ diag_y:
deviceConfig:
prefix: X10SA-ES-SCL:TRY
deviceTags:
- - state
+ - state
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -666,7 +668,7 @@ diag_z:
deviceConfig:
prefix: X10SA-ES-SCL:TRZ
deviceTags:
- - se
+ - se
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -677,7 +679,7 @@ fe_bpm1:
auto_monitor: true
read_pv: X10SA-FE-XBPM1:Current1:MeanValue_RBV
deviceTags:
- - bpm
+ - bpm
enabled: true
onFailure: buffer
readOnly: true
@@ -689,7 +691,7 @@ fe_bpm2:
auto_monitor: true
read_pv: X10SA-FE-XBPM1:Current2:MeanValue_RBV
deviceTags:
- - bpm
+ - bpm
enabled: true
onFailure: buffer
readOnly: true
@@ -701,7 +703,7 @@ fe_bpm3:
auto_monitor: true
read_pv: X10SA-FE-XBPM1:Current3:MeanValue_RBV
deviceTags:
- - bpm
+ - bpm
enabled: true
onFailure: buffer
readOnly: true
@@ -713,7 +715,7 @@ fe_bpm4:
auto_monitor: true
read_pv: X10SA-FE-XBPM1:Current4:MeanValue_RBV
deviceTags:
- - bpm
+ - bpm
enabled: true
onFailure: buffer
readOnly: true
@@ -724,7 +726,7 @@ fe_bpm_x:
deviceConfig:
prefix: X10SA-FE-XBPM1:TRX
deviceTags:
- - fe
+ - fe
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -734,7 +736,7 @@ fe_bpm_y:
deviceConfig:
prefix: X10SA-FE-XBPM1:TRY
deviceTags:
- - fe
+ - fe
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -745,7 +747,7 @@ fe_bpmsum:
auto_monitor: true
read_pv: X10SA-FE-XBPM1:SumAll:MeanValue_RBV
deviceTags:
- - bpm
+ - bpm
enabled: true
onFailure: buffer
readOnly: true
@@ -756,7 +758,7 @@ fe_sl_xcen:
deviceConfig:
prefix: X10SA-FE-SL1:CENTERX
deviceTags:
- - fe
+ - fe
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -766,7 +768,7 @@ fe_sl_xr:
deviceConfig:
prefix: X10SA-FE-SL1:TRXR
deviceTags:
- - fe
+ - fe
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -776,7 +778,7 @@ fe_sl_xsize:
deviceConfig:
prefix: X10SA-FE-SL1:SIZEX
deviceTags:
- - fe
+ - fe
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -786,7 +788,7 @@ fe_sl_xw:
deviceConfig:
prefix: X10SA-FE-SL1:TRXW
deviceTags:
- - fe
+ - fe
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -796,7 +798,7 @@ fe_sl_yb:
deviceConfig:
prefix: X10SA-FE-SL1:TRYB
deviceTags:
- - fe
+ - fe
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -806,7 +808,7 @@ fe_sl_ycen:
deviceConfig:
prefix: X10SA-FE-SL1:CENTERY
deviceTags:
- - fe
+ - fe
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -816,7 +818,7 @@ fe_sl_ysize:
deviceConfig:
prefix: X10SA-FE-SL1:SIZEY
deviceTags:
- - fe
+ - fe
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -826,7 +828,7 @@ fe_sl_yt:
deviceConfig:
prefix: X10SA-FE-SL1:TRYT
deviceTags:
- - fe
+ - fe
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -837,13 +839,13 @@ fl_bright:
auto_monitor: true
read_pv: X10SA-ES-FL:SET
deviceTags:
- - state
+ - state
enabled: true
onFailure: buffer
readoutPriority: baseline
userParameter:
- 'off': 0.0
- 'on': 3.0
+ "off": 0.0
+ "on": 3.0
tol: 0.01
type: continuous
hfm_bd:
@@ -852,7 +854,7 @@ hfm_bd:
deviceConfig:
prefix: X10SA-ES-HFM:BNDD
deviceTags:
- - hfm
+ - hfm
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -862,7 +864,7 @@ hfm_bu:
deviceConfig:
prefix: X10SA-ES-HFM:BNDU
deviceTags:
- - hfm
+ - hfm
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -872,7 +874,7 @@ hfm_pitch:
deviceConfig:
prefix: X10SA-ES-HFM:PITCH
deviceTags:
- - hfm
+ - hfm
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -882,7 +884,7 @@ hfm_roll:
deviceConfig:
prefix: X10SA-ES-HFM:ROLL
deviceTags:
- - hfm
+ - hfm
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -892,7 +894,7 @@ hfm_x:
deviceConfig:
prefix: X10SA-ES-HFM:TRX
deviceTags:
- - hfm
+ - hfm
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -902,7 +904,7 @@ hfm_xd:
deviceConfig:
prefix: X10SA-ES-HFM:TRXD
deviceTags:
- - hfm
+ - hfm
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -912,7 +914,7 @@ hfm_xu:
deviceConfig:
prefix: X10SA-ES-HFM:TRXU
deviceTags:
- - hfm
+ - hfm
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -922,7 +924,7 @@ hfm_y:
deviceConfig:
prefix: X10SA-ES-HFM:TRY
deviceTags:
- - hfm
+ - hfm
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -932,7 +934,7 @@ hfm_yaw:
deviceConfig:
prefix: X10SA-ES-HFM:YAW
deviceTags:
- - hfm
+ - hfm
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -942,7 +944,7 @@ hfm_ydw:
deviceConfig:
prefix: X10SA-ES-HFM:TRYDW
deviceTags:
- - hfm
+ - hfm
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -952,7 +954,7 @@ hfm_yr:
deviceConfig:
prefix: X10SA-ES-HFM:TRYR
deviceTags:
- - hfm
+ - hfm
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -962,7 +964,7 @@ hfm_yuw:
deviceConfig:
prefix: X10SA-ES-HFM:TRYUW
deviceTags:
- - hfm
+ - hfm
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -973,7 +975,7 @@ i1:
auto_monitor: true
read_pv: X10SA-ES-SCLDI:READOUT
deviceTags:
- - bpm
+ - bpm
enabled: true
onFailure: buffer
readOnly: true
@@ -985,7 +987,7 @@ i2:
auto_monitor: true
read_pv: X10SA-ES-XEYEDI:READOUT
deviceTags:
- - bpm
+ - bpm
enabled: true
onFailure: buffer
readOnly: true
@@ -994,7 +996,7 @@ id_gap:
description: undulator gap
deviceClass: pxii_bec.devices.undulator.UndulatorGap
deviceConfig:
- prefix: 'X10SA-UIND:'
+ prefix: "X10SA-UIND:"
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1005,7 +1007,7 @@ lu_bpm1:
auto_monitor: true
read_pv: X10SA-OP-LUBPM:Current1:MeanValue_RBV
deviceTags:
- - bpm
+ - bpm
enabled: true
onFailure: buffer
readOnly: true
@@ -1017,7 +1019,7 @@ lu_bpm2:
auto_monitor: true
read_pv: X10SA-OP-LUBPM:Current2:MeanValue_RBV
deviceTags:
- - bpm
+ - bpm
enabled: true
onFailure: buffer
readOnly: true
@@ -1029,7 +1031,7 @@ lu_bpm3:
auto_monitor: true
read_pv: X10SA-OP-LUBPM:Current3:MeanValue_RBV
deviceTags:
- - bpm
+ - bpm
enabled: true
onFailure: buffer
readOnly: true
@@ -1041,7 +1043,7 @@ lu_bpm4:
auto_monitor: true
read_pv: X10SA-OP-LUBPM:Current4:MeanValue_RBV
deviceTags:
- - bpm
+ - bpm
enabled: true
onFailure: buffer
readOnly: true
@@ -1052,7 +1054,7 @@ lu_bpm_x:
deviceConfig:
prefix: X10SA-OP-LUBPM:TRX
deviceTags:
- - lu
+ - lu
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1062,7 +1064,7 @@ lu_bpm_y:
deviceConfig:
prefix: X10SA-OP-LUBPM:TRY
deviceTags:
- - lu
+ - lu
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1073,7 +1075,7 @@ lu_bpmsum:
auto_monitor: true
read_pv: X10SA-OP-LUBPM:SumAll:MeanValue_RBV
deviceTags:
- - bpm
+ - bpm
enabled: true
onFailure: buffer
readOnly: true
@@ -1084,7 +1086,7 @@ lu_pod1_rotx:
deviceConfig:
prefix: X10SA-OP-LUPOD1:ROTX
deviceTags:
- - lu
+ - lu
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1094,7 +1096,7 @@ lu_pod1_roty:
deviceConfig:
prefix: X10SA-OP-LUPOD1:ROTY
deviceTags:
- - lu
+ - lu
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1104,7 +1106,7 @@ lu_pod1_rotz:
deviceConfig:
prefix: X10SA-OP-LUPOD1:ROTZ
deviceTags:
- - lu
+ - lu
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1114,7 +1116,7 @@ lu_pod1_y:
deviceConfig:
prefix: X10SA-OP-LUPOD1:TRY
deviceTags:
- - lu
+ - lu
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1124,7 +1126,7 @@ lu_pod1_z:
deviceConfig:
prefix: X10SA-OP-LUPOD1:TRZ
deviceTags:
- - lu
+ - lu
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1134,7 +1136,7 @@ lu_pod2_rotx:
deviceConfig:
prefix: X10SA-OP-LUPOD2:ROTX
deviceTags:
- - lu
+ - lu
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1144,7 +1146,7 @@ lu_pod2_roty:
deviceConfig:
prefix: X10SA-OP-LUPOD2:ROTY
deviceTags:
- - lu
+ - lu
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1154,7 +1156,7 @@ lu_pod2_rotz:
deviceConfig:
prefix: X10SA-OP-LUPOD2:ROTZ
deviceTags:
- - lu
+ - lu
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1164,7 +1166,7 @@ lu_pod2_y:
deviceConfig:
prefix: X10SA-OP-LUPOD2:TRY
deviceTags:
- - lu
+ - lu
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1174,7 +1176,7 @@ lu_pod2_z:
deviceConfig:
prefix: X10SA-OP-LUPOD2:TRZ
deviceTags:
- - lu
+ - lu
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1184,7 +1186,7 @@ lu_z1:
deviceConfig:
prefix: X10SA-OP-LUTRZ1:TRZ
deviceTags:
- - lu
+ - lu
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1194,7 +1196,7 @@ lu_z2:
deviceConfig:
prefix: X10SA-OP-LUTRZ2:TRZ
deviceTags:
- - lu
+ - lu
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1205,7 +1207,7 @@ mag_ok:
auto_monitor: true
read_pv: X10SA-ES-DFS:CBOX-CMP1
deviceTags:
- - se
+ - se
enabled: true
onFailure: buffer
readOnly: true
@@ -1217,7 +1219,7 @@ mag_rbv:
auto_monitor: true
read_pv: X10SA-ES-DFS:CBOX-USER1
deviceTags:
- - se
+ - se
enabled: true
onFailure: buffer
readOnly: true
@@ -1229,7 +1231,7 @@ mag_ref:
auto_monitor: true
read_pv: X10SA-ES-DFS:CBOX-REFVAL1
deviceTags:
- - se
+ - se
enabled: true
onFailure: buffer
readOnly: true
@@ -1238,7 +1240,7 @@ microscope_stats:
description: Stats Signal of MS camera
deviceClass: pxii_bec.devices.stats_signal.StatsSignal
deviceConfig:
- prefix: 'X10SA-ES-MS:'
+ prefix: "X10SA-ES-MS:"
enabled: true
readoutPriority: async
softwareTrigger: true
@@ -1249,7 +1251,7 @@ samcam_ecc:
auto_monitor: true
read_pv: X10SA-ES-MS:Stats5:Eccentricity_RBV
deviceTags:
- - scam
+ - scam
enabled: true
onFailure: buffer
readOnly: true
@@ -1261,7 +1263,7 @@ samcam_exp:
auto_monitor: true
read_pv: X10SA-ES-MS:cam1:AcquireTime
deviceTags:
- - scam
+ - scam
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1272,7 +1274,7 @@ samcam_gain:
auto_monitor: true
read_pv: X10SA-ES-MS:cam1:Gain
deviceTags:
- - scam
+ - scam
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1283,7 +1285,7 @@ samcam_max:
auto_monitor: true
read_pv: X10SA-ES-MS:Stats5:MaxValue_RBV
deviceTags:
- - scam
+ - scam
enabled: true
onFailure: buffer
readOnly: true
@@ -1295,7 +1297,7 @@ samcam_mean:
auto_monitor: true
read_pv: X10SA-ES-MS:Stats1:MeanValue_RBV
deviceTags:
- - scam
+ - scam
enabled: true
onFailure: buffer
readOnly: true
@@ -1307,7 +1309,7 @@ samcam_sigma:
auto_monitor: true
read_pv: X10SA-ES-MS:Stats1:Sigma_RBV
deviceTags:
- - scam
+ - scam
enabled: true
onFailure: buffer
readOnly: true
@@ -1319,7 +1321,7 @@ samcam_thresh:
auto_monitor: true
read_pv: X10SA-ES-MS:Stats5:CentroidThreshold
deviceTags:
- - scam
+ - scam
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1330,7 +1332,7 @@ samcam_x:
auto_monitor: true
read_pv: X10SA-ES-MS:Stats5:CentroidX_RBV
deviceTags:
- - scam
+ - scam
enabled: true
onFailure: buffer
readOnly: true
@@ -1342,7 +1344,7 @@ samcam_xcurs:
auto_monitor: true
read_pv: X10SA-ES-MS:Stats5:CursorX
deviceTags:
- - scam
+ - scam
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1353,7 +1355,7 @@ samcam_xcursprof:
auto_monitor: true
read_pv: X10SA-ES-MS:Stats5:ProfileCursorX_RBV
deviceTags:
- - scam
+ - scam
enabled: true
onFailure: buffer
readOnly: true
@@ -1365,7 +1367,7 @@ samcam_xsig:
auto_monitor: true
read_pv: X10SA-ES-MS:Stats5:SigmaX_RBV
deviceTags:
- - scam
+ - scam
enabled: true
onFailure: buffer
readOnly: true
@@ -1377,7 +1379,7 @@ samcam_y:
auto_monitor: true
read_pv: X10SA-ES-MS:Stats5:CentroidY_RBV
deviceTags:
- - scam
+ - scam
enabled: true
onFailure: buffer
readOnly: true
@@ -1389,7 +1391,7 @@ samcam_ycursprof:
auto_monitor: true
read_pv: X10SA-ES-MS:Stats5:ProfileCursorY_RBV
deviceTags:
- - scam
+ - scam
enabled: true
onFailure: buffer
readOnly: true
@@ -1401,7 +1403,7 @@ samcam_ysig:
auto_monitor: true
read_pv: X10SA-ES-MS:Stats5:SigmaY_RBV
deviceTags:
- - scam
+ - scam
enabled: true
onFailure: buffer
readOnly: true
@@ -1410,9 +1412,9 @@ scam:
description: Sample camera image contrast
deviceClass: pxii_bec.devices.contrast.CameraContrast
deviceConfig:
- prefix: 'X10SA-ES-MS:Stats1:'
+ prefix: "X10SA-ES-MS:Stats1:"
deviceTags:
- - detector
+ - detector
enabled: true
readOnly: true
readoutPriority: monitored
@@ -1422,7 +1424,7 @@ scam_zoom:
deviceConfig:
prefix: X10SA-ES-MS:ZOOM
deviceTags:
- - scam
+ - scam
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1433,19 +1435,19 @@ sls_current:
auto_monitor: true
read_pv: ARS07-DPCT-0100:CURR
deviceTags:
- - SLS
+ - SLS
enabled: true
onFailure: buffer
readOnly: true
readoutPriority: monitored
smargon:
description: REST-based device which connects to Smargopolo
- deviceClass: pxii_bec.devices.smargopolo_smargon.Smargon
+ deviceClass: pxii_bec.devices.Smargon
deviceConfig:
prefix: http://x10sa-smargopolo.psi.ch:3000
deviceTags:
- - motors
- - smargon
+ - motors
+ - smargon
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1467,7 +1469,7 @@ ss_bpm1:
auto_monitor: true
read_pv: X10SA-ES-SSBPM:Current1:MeanValue_RBV
deviceTags:
- - bpm
+ - bpm
enabled: true
onFailure: buffer
readOnly: true
@@ -1479,7 +1481,7 @@ ss_bpm2:
auto_monitor: true
read_pv: X10SA-ES-SSBPM:Current2:MeanValue_RBV
deviceTags:
- - bpm
+ - bpm
enabled: true
onFailure: buffer
readOnly: true
@@ -1491,7 +1493,7 @@ ss_bpm3:
auto_monitor: true
read_pv: X10SA-ES-SSBPM:Current3:MeanValue_RBV
deviceTags:
- - bpm
+ - bpm
enabled: true
onFailure: buffer
readOnly: true
@@ -1503,7 +1505,7 @@ ss_bpm4:
auto_monitor: true
read_pv: X10SA-ES-SSBPM:Current4:MeanValue_RBV
deviceTags:
- - bpm
+ - bpm
enabled: true
onFailure: buffer
readOnly: true
@@ -1514,7 +1516,7 @@ ss_bpm_x:
deviceConfig:
prefix: X10SA-ES-SSBPM:TRX
deviceTags:
- - ss
+ - ss
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1524,7 +1526,7 @@ ss_bpm_y:
deviceConfig:
prefix: X10SA-ES-SSBPM:TRY
deviceTags:
- - ss
+ - ss
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1535,7 +1537,7 @@ ss_bpmsum:
auto_monitor: true
read_pv: X10SA-ES-SSBPM:SumAll:MeanValue_RBV
deviceTags:
- - bpm
+ - bpm
enabled: true
onFailure: buffer
readOnly: true
@@ -1546,7 +1548,7 @@ ss_f1_x:
deviceConfig:
prefix: X10SA-ES-SSFI1:TRX
deviceTags:
- - ss
+ - ss
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1556,7 +1558,7 @@ ss_f2_x:
deviceConfig:
prefix: X10SA-ES-SSFI2:TRX
deviceTags:
- - ss
+ - ss
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1566,7 +1568,7 @@ ss_f3_x:
deviceConfig:
prefix: X10SA-ES-SSFI3:TRX
deviceTags:
- - ss
+ - ss
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1576,7 +1578,7 @@ ss_f4_x:
deviceConfig:
prefix: X10SA-ES-SSFI4:TRX
deviceTags:
- - ss
+ - ss
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1586,7 +1588,7 @@ ss_sl_xcen:
deviceConfig:
prefix: X10SA-ES-SSSLH:CENTER
deviceTags:
- - ss
+ - ss
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1596,7 +1598,7 @@ ss_sl_xr:
deviceConfig:
prefix: X10SA-ES-SSSLH:TRXR
deviceTags:
- - ss
+ - ss
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1606,7 +1608,7 @@ ss_sl_xsize:
deviceConfig:
prefix: X10SA-ES-SSSLH:SIZE
deviceTags:
- - ss
+ - ss
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1616,7 +1618,7 @@ ss_sl_xw:
deviceConfig:
prefix: X10SA-ES-SSSLH:TRXW
deviceTags:
- - ss
+ - ss
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1626,7 +1628,7 @@ ss_sl_yb:
deviceConfig:
prefix: X10SA-ES-SSSLV:TRYB
deviceTags:
- - ss
+ - ss
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1636,7 +1638,7 @@ ss_sl_ycen:
deviceConfig:
prefix: X10SA-ES-SSSLV:CENTER
deviceTags:
- - ss
+ - ss
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1646,7 +1648,7 @@ ss_sl_ysize:
deviceConfig:
prefix: X10SA-ES-SSSLV:SIZE
deviceTags:
- - ss
+ - ss
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1656,7 +1658,7 @@ ss_sl_yt:
deviceConfig:
prefix: X10SA-ES-SSSLV:TRYT
deviceTags:
- - ss
+ - ss
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1666,7 +1668,7 @@ ss_xi_x:
deviceConfig:
prefix: X10SA-ES-SSXI:TRX
deviceTags:
- - ss
+ - ss
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1680,7 +1682,7 @@ ss_xi_y:
deviceConfig:
prefix: X10SA-ES-SSXI:TRY
deviceTags:
- - ss
+ - ss
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1691,7 +1693,7 @@ ss_xicam_exp:
auto_monitor: true
read_pv: X10SA-ES-SSCAM:cam1:AcquireTime
deviceTags:
- - ss
+ - ss
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1702,7 +1704,7 @@ ss_xicam_gain:
auto_monitor: true
read_pv: X10SA-ES-SSCAM:cam1:Gain
deviceTags:
- - ss
+ - ss
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1713,7 +1715,7 @@ ss_xicam_max:
auto_monitor: true
read_pv: X10SA-ES-SSCAM:Stats5:MaxValue_RBV
deviceTags:
- - ss
+ - ss
enabled: true
onFailure: buffer
readOnly: true
@@ -1725,7 +1727,7 @@ ss_xicam_x:
auto_monitor: true
read_pv: X10SA-ES-SSCAM:Stats5:CentroidX_RBV
deviceTags:
- - ss
+ - ss
enabled: true
onFailure: buffer
readOnly: true
@@ -1737,7 +1739,7 @@ ss_xicam_xsig:
auto_monitor: true
read_pv: X10SA-ES-SSCAM:Stats5:SigmaX_RBV
deviceTags:
- - ss
+ - ss
enabled: true
onFailure: buffer
readOnly: true
@@ -1749,7 +1751,7 @@ ss_xicam_y:
auto_monitor: true
read_pv: X10SA-ES-SSCAM:Stats5:CentroidY_RBV
deviceTags:
- - ss
+ - ss
enabled: true
onFailure: buffer
readOnly: true
@@ -1761,7 +1763,7 @@ ss_xicam_ysig:
auto_monitor: true
read_pv: X10SA-ES-SSCAM:Stats5:SigmaY_RBV
deviceTags:
- - ss
+ - ss
enabled: true
onFailure: buffer
readOnly: true
@@ -1772,7 +1774,7 @@ transm:
deviceConfig:
read_pv: X10SA-ES-SSFI:TRANSM-SET
deviceTags:
- - transm
+ - transm
enabled: true
readoutPriority: baseline
vfm_bd:
@@ -1781,7 +1783,7 @@ vfm_bd:
deviceConfig:
prefix: X10SA-ES-VFM:BNDD
deviceTags:
- - vfm
+ - vfm
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1791,7 +1793,7 @@ vfm_bu:
deviceConfig:
prefix: X10SA-ES-VFM:BNDU
deviceTags:
- - vfm
+ - vfm
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1801,7 +1803,7 @@ vfm_pitch:
deviceConfig:
prefix: X10SA-ES-VFM:PITCH
deviceTags:
- - vfm
+ - vfm
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1811,7 +1813,7 @@ vfm_roll:
deviceConfig:
prefix: X10SA-ES-VFM:ROLL
deviceTags:
- - vfm
+ - vfm
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1821,7 +1823,7 @@ vfm_x:
deviceConfig:
prefix: X10SA-ES-VFM:TRX
deviceTags:
- - vfm
+ - vfm
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1831,7 +1833,7 @@ vfm_xd:
deviceConfig:
prefix: X10SA-ES-VFM:TRXD
deviceTags:
- - vfm
+ - vfm
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1841,7 +1843,7 @@ vfm_xu:
deviceConfig:
prefix: X10SA-ES-VFM:TRXU
deviceTags:
- - vfm
+ - vfm
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1851,7 +1853,7 @@ vfm_y:
deviceConfig:
prefix: X10SA-ES-VFM:TRY
deviceTags:
- - vfm
+ - vfm
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1861,7 +1863,7 @@ vfm_yaw:
deviceConfig:
prefix: X10SA-ES-VFM:YAW
deviceTags:
- - vfm
+ - vfm
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1871,7 +1873,7 @@ vfm_ydr:
deviceConfig:
prefix: X10SA-ES-VFM:TRYDR
deviceTags:
- - vfm
+ - vfm
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1881,7 +1883,7 @@ vfm_yur:
deviceConfig:
prefix: X10SA-ES-VFM:TRYUR
deviceTags:
- - vfm
+ - vfm
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1891,7 +1893,7 @@ vfm_yw:
deviceConfig:
prefix: X10SA-ES-VFM:TRYW
deviceTags:
- - vfm
+ - vfm
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1901,7 +1903,7 @@ xi_focus:
deviceConfig:
prefix: X10SA-ES-XEYE:FOCUS
deviceTags:
- - xeye
+ - xeye
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1911,7 +1913,7 @@ xi_x:
deviceConfig:
prefix: X10SA-ES-XEYE:TRX
deviceTags:
- - xeye
+ - xeye
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1921,7 +1923,7 @@ xi_zoom:
deviceConfig:
prefix: X10SA-ES-XEYE:ZOOM
deviceTags:
- - xeye
+ - xeye
enabled: true
onFailure: buffer
readoutPriority: baseline
@@ -1932,7 +1934,7 @@ xidiode:
auto_monitor: true
read_pv: X10SA-ES-XEYEDI:READOUT
deviceTags:
- - xeye
+ - xeye
enabled: true
onFailure: buffer
readOnly: true
@@ -1944,7 +1946,7 @@ xrf_pos:
auto_monitor: true
read_pv: X10SA-ES-XRF:POS-SET
deviceTags:
- - state
+ - state
enabled: true
onFailure: buffer
readoutPriority: baseline
diff --git a/pxii_bec/devices/__init__.py b/pxii_bec/devices/__init__.py
index e69de29..95e8f8f 100644
--- a/pxii_bec/devices/__init__.py
+++ b/pxii_bec/devices/__init__.py
@@ -0,0 +1,6 @@
+from mx_bec.devices.aerotech import Aerotech
+from mx_bec.devices.sim_sample_changer import SimSampleChanger
+from mx_bec.devices.sim_stages import SimAerotechStage, SimGoniometer
+from mx_bec.devices.smargopolo_smargon import Smargon
+
+__all__ = ["Aerotech", "SimAerotechStage", "SimGoniometer", "SimSampleChanger", "Smargon"]
diff --git a/pxii_bec/devices/aerotech.py b/pxii_bec/devices/aerotech.py
deleted file mode 100644
index 9bd38b0..0000000
--- a/pxii_bec/devices/aerotech.py
+++ /dev/null
@@ -1,43 +0,0 @@
-from ophyd import Component as Cpt
-
-from .http import TIMESTAMP_ID, HttpDeviceController, HttpDeviceSignal, HttpOphydDevice
-
-
-class AerotechController(HttpDeviceController):
- _readback_endpoint = "/status"
- _target_endpoint = "/position"
-
- def __init__(self, *, prefix, **kwargs):
- self._readbacks: dict[str, dict[str, float | bool]] = {}
- super().__init__(prefix=prefix, **kwargs)
-
- def put(self, axis: str, val: float):
- self._rest_post(body={axis: val})
-
- def get_readback(self, axis_id: str) -> tuple[float, float] | None:
- with self._readback_lock:
- if axis_id not in self._readbacks or TIMESTAMP_ID not in self._readbacks:
- return None
- return self._readbacks.get(axis_id)["pos"], self._readbacks.get(TIMESTAMP_ID) # type: ignore
-
-
-class Aerotech(HttpOphydDevice):
- controller_class = AerotechController
-
- x = Cpt(HttpDeviceSignal, axis_identifier="x", tolerance=0.01)
- y = Cpt(HttpDeviceSignal, axis_identifier="y", tolerance=0.01)
- z = Cpt(HttpDeviceSignal, axis_identifier="z", tolerance=0.01)
- u = Cpt(HttpDeviceSignal, axis_identifier="u", tolerance=0.01)
- vel_u_deg_s = Cpt(HttpDeviceSignal, axis_identifier="vel_u_deg_s", tolerance=0.01)
-
-
-def _test():
- a = Aerotech(name="aerotech", prefix="http://mx-x10sa-queue-01:5234")
- a.wait_for_connection()
- return a
-
-
-if __name__ == "__main__":
- aerotech = _test()
- print(aerotech.read())
- aerotech.stop()
diff --git a/pxii_bec/devices/http.py b/pxii_bec/devices/http.py
deleted file mode 100644
index 38b612a..0000000
--- a/pxii_bec/devices/http.py
+++ /dev/null
@@ -1,178 +0,0 @@
-import time
-from abc import ABC, abstractmethod
-from threading import Event, RLock, Thread
-from typing import Any
-
-from ophyd import OphydObject
-from ophyd_devices import PSIDeviceBase
-from ophyd_devices.utils.socket import SocketSignal
-from requests import Response, Session
-
-TIMESTAMP_ID = "__timestamp"
-_POLL_INTERVAL_SLOW = 0.1
-
-
-class HttpRestError(Exception):
- """Error for rest calls from a HttpRestSignal."""
-
- def __init__(self, resp: Response, *args: object, value: Any | None = None) -> None:
- method, url = resp.request.method, resp.request.url
- data = f"{str(value)} to " if value is not None else ""
- super().__init__(
- f"Could not {method} {data}{url}. Code: {resp.status_code}. Reason: {resp.reason}.",
- *args,
- )
-
-
-class HttpDeviceController(OphydObject, ABC):
- """Controller to consolidate polling loops and other REST calls for devices which communicate
- with HTTP REST interfaces"""
-
- _readback_endpoint: str
- _target_endpoint: str
-
- def __init__(self, *, prefix, **kwargs):
- self._readbacks: dict
- self._session = Session()
- self._prefix = prefix
- self._targets = {}
- self._signal_registry: set[str] = set()
- self._readback_poll_interval: float = _POLL_INTERVAL_SLOW
-
- super().__init__(**kwargs)
- self._setup_readback()
-
- def _setup_readback(self):
- self._stop_monitor_readback_event = Event()
- self._readback_lock = RLock()
- self._monitor_readback_thread = Thread(
- target=self._monitor,
- args=[
- self._readback_endpoint,
- self._stop_monitor_readback_event,
- self._readback_lock,
- self._readbacks,
- ],
- )
-
- def manual_update(self):
- self._update_reading(self._readback_endpoint, self._readback_lock, self._readbacks)
-
- def _update_reading(self, endpoint: str, lock: RLock, buffer: dict):
- data = self._rest_get(endpoint)
- timestamp = time.monotonic()
- with lock:
- buffer.update(data)
- buffer["__timestamp"] = timestamp
-
- def _monitor(self, endpoint: str, event: Event, lock: RLock, buffer: dict):
- while not event.is_set():
- self._update_reading(endpoint, lock, buffer)
- time.sleep(self._readback_poll_interval)
-
- def _clean_monitor(self):
- if self._monitor_readback_thread.is_alive():
- self._stop_monitor_readback_event.set()
- self._monitor_readback_thread.join(timeout=2)
- if self._monitor_readback_thread.is_alive():
- raise RuntimeError("Failed to clean up Aerotech monitor thread.")
-
- def register(self, axis_id: str):
- self._signal_registry.add(axis_id)
-
- def _rest_get(self, endpoint):
- resp = self._session.get(self._prefix + endpoint)
- if not resp.ok:
- raise HttpRestError(resp)
- return resp.json()
-
- def _rest_put(self, params: dict | None = None, body: dict | None = None):
- resp = self._session.put(self._prefix + self._target_endpoint, params=params, json=body)
- if not resp.ok:
- raise HttpRestError(resp, value=params)
-
- def _rest_post(self, params: dict | None = None, body: dict | None = None):
- resp = self._session.post(self._prefix + self._target_endpoint, params=params, json=body)
- if not resp.ok:
- raise HttpRestError(resp, value=params)
-
- def start_monitor(self):
- """Start or restart the automonitor thread."""
- self._clean_monitor()
- self._setup_readback()
- self._monitor_readback_thread.start()
-
- def monitor_stopped(self):
- return not self._monitor_readback_thread.is_alive()
-
- def put(self, axis: str, val: float):
- self._rest_put({axis: val})
-
- @abstractmethod
- def get_readback(self, axis_id: str) -> tuple[float, float] | None:
- """Return a tuple (reading, timestamp) if the axis_id exists"""
-
- def stop(self):
- # There doesn't appear to be a stop endpoint on the server
- # Best effort: set the target to the current position
- pass
- # TODO: self._rest_put(self._readbacks)
-
-
-class HttpDeviceSignal(SocketSignal):
- """Ophyd signal which gets and puts to a REST API rather than EPICS PVs, mediated through the Aerotech
- Controller"""
-
- def __init__(self, *args, axis_identifier: str, **kwargs):
- super().__init__(*args, **kwargs)
- controller: HttpDeviceController | None = getattr(self.root, "controller", None)
- if controller is None:
- raise TypeError("HttpDeviceSignal must be used in a device with a HttpDeviceController")
- self._controller = controller
- self._axis_id = axis_identifier
- self._controller.register(self._axis_id)
-
- def _socket_get(self): # type: ignore
- self._readback, self.metadata["timestamp"] = self._controller.get_readback(
- self._axis_id
- ) or (0.0, 0.0)
- return self._readback
-
- def _socket_set(self, val: float):
- self._controller.put(self._axis_id, val)
-
- def get(self, **kwargs):
- if self._controller.monitor_stopped():
- self._controller.start_monitor()
- return super().get(**kwargs)
-
-
-class HttpOphydDevice(PSIDeviceBase):
- controller_class: type[HttpDeviceController]
-
- def __init__(
- self,
- *,
- name: str,
- prefix: str = "",
- scan_info=None,
- device_manager=None,
- **kwargs,
- ):
- self.controller = self.controller_class(prefix=prefix)
- super().__init__(
- name=name,
- prefix=prefix,
- scan_info=scan_info,
- device_manager=device_manager,
- **kwargs,
- )
-
- def wait_for_connection(self, **kwargs): # type: ignore
- self.controller.start_monitor()
- self.controller.manual_update()
- return super().wait_for_connection(**kwargs)
-
- def stop(self, *, success: bool = False) -> None:
- self.controller.stop()
- return super().stop(success=success)
diff --git a/pxii_bec/devices/smargopolo_smargon.py b/pxii_bec/devices/smargopolo_smargon.py
deleted file mode 100644
index a7c4618..0000000
--- a/pxii_bec/devices/smargopolo_smargon.py
+++ /dev/null
@@ -1,42 +0,0 @@
-from ophyd import Component as Cpt
-from ophyd_devices import PSIDeviceBase
-
-from .http import HttpDeviceController, HttpDeviceSignal, HttpOphydDevice
-
-_TIMESTAMP_ID = "__timestamp"
-_POLL_INTERVAL_SLOW = 0.1
-
-
-class SmargonController(HttpDeviceController):
- """Controller to consolidate polling loops and other REST calls for the smargon"""
-
- _readback_endpoint = "/readbackSCS"
- _target_endpoint = "/targetSCS"
-
- def __init__(self, *, prefix, **kwargs):
- self._readbacks: dict[str, float] = {}
- super().__init__(prefix=prefix, **kwargs)
-
- def get_readback(self, axis_id: str) -> tuple[float, float] | None:
- with self._readback_lock:
- if axis_id not in self._readbacks or _TIMESTAMP_ID not in self._readbacks:
- return None
- return self._readbacks.get(axis_id), self._readbacks.get(_TIMESTAMP_ID) # type: ignore
-
- def put(self, axis: str, val: float):
- self._rest_put(params={axis: val})
-
- def stop(self):
- # There doesn't appear to be a stop endpoint on the server
- # Best effort: set the target to the current position
- self._rest_put(params=self._readbacks)
-
-
-class Smargon(HttpOphydDevice):
- controller_class = SmargonController
-
- x = Cpt(HttpDeviceSignal, axis_identifier="SHX", tolerance=0.01)
- y = Cpt(HttpDeviceSignal, axis_identifier="SHY", tolerance=0.01)
- z = Cpt(HttpDeviceSignal, axis_identifier="SHZ", tolerance=0.01)
- phi = Cpt(HttpDeviceSignal, axis_identifier="PHI", tolerance=0.01)
- chi = Cpt(HttpDeviceSignal, axis_identifier="CHI", tolerance=0.01)
diff --git a/pxii_bec/messages.py b/pxii_bec/messages.py
new file mode 100644
index 0000000..5cefdde
--- /dev/null
+++ b/pxii_bec/messages.py
@@ -0,0 +1,18 @@
+"""Message types of the MX plugins, re-exported from mx_bec so that BEC's message decoder can
+find them through the `bec.messages` entry point registered by this package."""
+
+from mx_bec.messages import (
+ MXMeasurementSequenceMessage,
+ MXQueueChangedMessage,
+ MXSampleExecutionMessage,
+ MXTaskExecutionMessage,
+ OpticalPredictionMessage,
+)
+
+__all__ = [
+ "MXMeasurementSequenceMessage",
+ "MXTaskExecutionMessage",
+ "MXSampleExecutionMessage",
+ "MXQueueChangedMessage",
+ "OpticalPredictionMessage",
+]
diff --git a/pxii_bec/scripts/init_beamline.py b/pxii_bec/scripts/init_beamline.py
index 39e25d7..57549fc 100755
--- a/pxii_bec/scripts/init_beamline.py
+++ b/pxii_bec/scripts/init_beamline.py
@@ -1,10 +1,15 @@
"""Initialise sample environment devices and beamline states."""
-import os
import importlib
+import os
from dataclasses import dataclass
from pathlib import Path
+from pxii_bec.macros.beamline_planner import StateChangePlanner
+from pxii_bec.macros.beamline_state_manager import DefineStatesManager
+from pxii_bec.macros.dependencies import planner_deps
+from pxii_bec.macros.devices_manager import DeviceManager
+
@dataclass
class Environment:
@@ -39,7 +44,7 @@ class Environment:
if self.beamline not in self.beamline_configs:
raise ValueError(
- f"Unknown beamline '{self.beamline}'. " f"Choose from {list(self.beamline_configs)}"
+ f"Unknown beamline '{self.beamline}'. Choose from {list(self.beamline_configs)}"
)
cfg = self.beamline_configs[self.beamline]
diff --git a/pyproject.toml b/pyproject.toml
index 2229991..fd7e7a1 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -12,7 +12,7 @@ classifiers = [
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering",
]
-dependencies = ["pandas~=2.0", "matplotlib"]
+dependencies = ["mx_bec", "pandas~=2.0", "matplotlib"]
[project.optional-dependencies]
dev = [
@@ -59,6 +59,12 @@ plugin_widgets_update = "pxii_bec.bec_widgets.auto_updates"
[project.entry-points."bec.widgets.user_widgets"]
plugin_widgets = "pxii_bec.bec_widgets.widgets"
+[project.entry-points."bec.messages"]
+plugin_messages = "pxii_bec.messages"
+
+[project.entry-points."bec.bl_states"]
+plugin_bl_states = "pxii_bec.states"
+
[tool.hatch.build.targets.wheel]
include = ["*"]
diff --git a/tests/tests_devices/mock_smargopolo.py b/tests/tests_devices/mock_smargopolo.py
deleted file mode 100644
index 466063e..0000000
--- a/tests/tests_devices/mock_smargopolo.py
+++ /dev/null
@@ -1,110 +0,0 @@
-"""A mock smargopolo REST interface with mock motoers, for testing devices against"""
-
-import asyncio
-import random
-import time
-from contextlib import asynccontextmanager
-from typing import Iterable
-
-import uvicorn
-from fastapi import FastAPI, HTTPException, Query, Request
-from pydantic import BaseModel
-
-AXES = ["SHX", "SHY", "SHZ", "PHI", "CHI"]
-
-
-class Motor:
- def __init__(self, velocity: float = 1.0):
- self.position = 0.0
- self.target = 0.0
- self.velocity = velocity
- self.moving = False
- self._last_update = time.monotonic()
-
- def update(self):
- now = time.monotonic()
- dt = now - self._last_update
- self._last_update = now
-
- if not self.moving:
- return
-
- jitter_factor = random.random() * 0.05 - 0.025 # +- 2.5% jitter in step
- distance = self.target - self.position
- direction = 1 if distance > 0 else -1
- step = direction * self.velocity * dt
-
- if abs(step) >= abs(distance):
- self.position = self.target + (step * jitter_factor)
- self.moving = False
- else:
- self.position += step * (1 + jitter_factor)
-
-
-motors: dict[str, Motor] = {
- "SHX": Motor(velocity=3),
- "SHY": Motor(velocity=2.5),
- "SHZ": Motor(velocity=2),
- "PHI": Motor(velocity=1.0),
- "CHI": Motor(velocity=0.7),
-}
-
-
-class MoveRequest(BaseModel):
- target: float
-
-
-@asynccontextmanager
-async def lifespan(app: FastAPI):
- async def updater():
- while True:
- for motor in motors.values():
- motor.update()
- await asyncio.sleep(0.02) # 50 Hz update loop
-
- task = asyncio.create_task(updater())
- yield
- task.cancel()
- try:
- await task
- except asyncio.CancelledError:
- pass
-
-
-app = FastAPI(lifespan=lifespan)
-
-
-def validate_axes(axes: Iterable[str] | None) -> list[str]:
- if axes is None:
- return AXES
- for a in axes:
- if a not in AXES:
- raise HTTPException(status_code=404, detail=f"Unknown axis: {a}")
- return list(axes)
-
-
-@app.get("/readbackSCS")
-async def readback_scs(axis: list[str] | None = Query(None)):
- selected_axes = validate_axes(axis)
- return {ax: motors[ax].position for ax in selected_axes}
-
-
-@app.put("/targetSCS")
-async def target_scs(req: Request):
- targets = {ax: float(t) for ax, t in req.query_params.items()}
- if targets is None:
- return {}
-
- selected_axes = validate_axes(targets.keys())
-
- for a in selected_axes:
- motor = motors[a]
- motor.update()
- motor.target = targets[a]
- motor.moving = True
-
- return {"targets": targets, "message": "Move started"}
-
-
-if __name__ == "__main__":
- uvicorn.run(app, host="0.0.0.0", port=8000, reload=False)
diff --git a/tests/tests_devices/test_aerotech.py b/tests/tests_devices/test_aerotech.py
index 49e2fc2..90475eb 100644
--- a/tests/tests_devices/test_aerotech.py
+++ b/tests/tests_devices/test_aerotech.py
@@ -1,58 +1,64 @@
+"""Smoke tests of the Aerotech device as re-exported by pxii_bec; the device itself is tested in
+mx_bec."""
+
from copy import copy
from threading import RLock
from unittest.mock import ANY
import pytest
+from mx_bec.devices.aerotech import Aerotech as MxAerotech
+
+from pxii_bec.devices import Aerotech
+
+AXES = ("x", "y", "z", "u")
class MockServer:
+ """Just enough of the AareScan REST API for reading and moving axes."""
+
def __init__(self) -> None:
self.lock = RLock()
- self.mock_data = {
- "x": {"pos": 1.0},
- "y": {"pos": 1.0},
- "z": {"pos": 1.0},
- "u": {"pos": 1.0},
- "vel_u_deg_s": {"pos": 1.0},
- }
+ self.mock_data = {axis: {"pos": 1.0} for axis in AXES}
def get(self, endpoint):
with self.lock:
return copy(self.mock_data)
- def put(self, params: dict | None = None, body: dict | None = None):
+ def post(self, params: dict | None = None, body: dict | None = None, endpoint=None):
with self.lock:
assert body is not None
- for k, v in body.items():
- self.mock_data[k]["pos"] = v
+ for axis, value in body.items():
+ if axis in self.mock_data: # the body also carries the velocity parameter
+ self.mock_data[axis]["pos"] = value
@pytest.fixture
def aerotech():
mock_server = MockServer()
- from pxii_bec.devices.aerotech import Aerotech
-
- s = Aerotech(name="aerotech", prefix="http://test-aerotech.psi.ch")
- s.controller._rest_get = mock_server.get
- s.controller._rest_post = mock_server.put
- yield s
- s.controller._stop_monitor_readback_event.set()
+ device = Aerotech(name="aerotech", prefix="http://test-aerotech.psi.ch")
+ device.controller._rest_get = mock_server.get
+ device.controller._rest_post = mock_server.post
+ device.controller.validate = lambda endpoint, body: (True, "")
+ yield device
+ device.controller._stop_monitor_readback_event.set()
+ device.destroy()
-class TestAerotech:
- def test_aerotech_read(self, aerotech):
- aerotech.wait_for_connection()
- reading = aerotech.read()
- assert dict(reading) == {
- "aerotech_x": {"value": 1.0, "timestamp": ANY},
- "aerotech_y": {"value": 1.0, "timestamp": ANY},
- "aerotech_z": {"value": 1.0, "timestamp": ANY},
- "aerotech_u": {"value": 1.0, "timestamp": ANY},
- "aerotech_vel_u_deg_s": {"value": 1.0, "timestamp": ANY},
- }
+def test_is_the_mx_bec_device():
+ assert Aerotech is MxAerotech
- def test_aerotech_set_with_status(self, aerotech):
- aerotech.wait_for_connection()
- st = aerotech.x.set(5.0)
- st.wait(timeout=1)
- assert aerotech.x.get() == 5.0
+
+def test_aerotech_read(aerotech):
+ aerotech.wait_for_connection()
+ reading = dict(aerotech.read())
+ # besides the axes, read() reports the valid/message state of the scan parameter groups
+ assert {k: v for k, v in reading.items() if k.removeprefix("aerotech_") in AXES} == {
+ f"aerotech_{axis}": {"value": 1.0, "timestamp": ANY} for axis in AXES
+ }
+ assert reading["aerotech_gridscan_config_valid"]["value"] is True
+
+
+def test_aerotech_set_with_status(aerotech):
+ aerotech.wait_for_connection()
+ aerotech.x.set(5.0).wait(timeout=1)
+ assert aerotech.x.get() == 5.0
diff --git a/tests/tests_devices/test_smargon.py b/tests/tests_devices/test_smargon.py
index fc14015..1b8f7bc 100644
--- a/tests/tests_devices/test_smargon.py
+++ b/tests/tests_devices/test_smargon.py
@@ -1,14 +1,24 @@
+"""Smoke tests of the Smargon device as re-exported by pxii_bec; the device itself is tested in
+mx_bec against a mock smargopolo server."""
+
from copy import copy
from threading import RLock
from unittest.mock import ANY
import pytest
+from mx_bec.devices.smargopolo_smargon import Smargon as MxSmargon
+
+from pxii_bec.devices import Smargon
+
+AXES = ("SHX", "SHY", "SHZ", "PHI", "CHI")
class MockServer:
+ """Just enough of the smargopolo REST API for reading and moving axes."""
+
def __init__(self) -> None:
self.lock = RLock()
- self.mock_data = {"SHX": 1.0, "SHY": 1.0, "SHZ": 1.0, "PHI": 1.0, "CHI": 1.0}
+ self.mock_data = {axis: 1.0 for axis in AXES}
def get(self, endpoint):
with self.lock:
@@ -23,29 +33,28 @@ class MockServer:
@pytest.fixture
def smargon():
mock_server = MockServer()
- from pxii_bec.devices.smargopolo_smargon import Smargon
-
- s = Smargon(name="smargon", prefix="http://test-smargopolo.psi.ch")
- s.controller._rest_get = mock_server.get
- s.controller._rest_put = mock_server.put
- yield s
- s.controller._stop_monitor_readback_event.set()
+ device = Smargon(name="smargon", prefix="http://test-smargopolo.psi.ch")
+ device.controller._rest_get = mock_server.get
+ device.controller._rest_put = mock_server.put
+ yield device
+ device.controller._stop_monitor_readback_event.set()
+ device.destroy()
-class TestSmargon:
- def test_smargon_read(self, smargon):
- smargon.wait_for_connection()
- reading = smargon.read()
- assert dict(reading) == {
- "smargon_x": {"value": 1.0, "timestamp": ANY},
- "smargon_y": {"value": 1.0, "timestamp": ANY},
- "smargon_z": {"value": 1.0, "timestamp": ANY},
- "smargon_phi": {"value": 1.0, "timestamp": ANY},
- "smargon_chi": {"value": 1.0, "timestamp": ANY},
- }
+def test_is_the_mx_bec_device():
+ assert Smargon is MxSmargon
- def test_smargon_set_with_status(self, smargon):
- smargon.wait_for_connection()
- st = smargon.x.set(5.0)
- st.wait(timeout=1)
- assert smargon.x.get() == 5.0
+
+def test_smargon_read(smargon):
+ smargon.wait_for_connection()
+ reading = smargon.read()
+ assert dict(reading) == {
+ f"smargon_{axis}": {"value": 1.0, "timestamp": ANY}
+ for axis in ("x", "y", "z", "phi", "chi")
+ }
+
+
+def test_smargon_set_with_status(smargon):
+ smargon.wait_for_connection()
+ smargon.x.set(5.0).wait(timeout=1)
+ assert smargon.x.get() == 5.0