Compare commits

...

5 Commits

Author SHA1 Message Date
9e48dca5e2 refactor: copier upgrade to v1-2-2
All checks were successful
CI for csaxs_bec / test (pull_request) Successful in 1m31s
CI for csaxs_bec / test (push) Successful in 1m31s
2025-09-12 15:44:09 +02:00
Holler
dc3d51afc4 fixed issue with move_to_start 2025-09-12 15:43:38 +02:00
Holler
2a579c957d fixes 2025-09-12 15:43:38 +02:00
Holler
66cd89ed63 flomni fixes 2025-09-12 15:43:38 +02:00
d06fe65491 feat: update repository with copier template for migration to gitea 2025-09-11 15:23:35 +02:00
9 changed files with 127 additions and 15 deletions

View File

@@ -2,7 +2,7 @@
# It is needed to track the repo template version, and editing may break things.
# This file will be overwritten by copier on template updates.
_commit: v1.1.2
_commit: v1.2.2
_src_path: https://github.com/bec-project/plugin_copier_template.git
make_commit: false
project_name: csaxs_bec

97
.gitea/workflows/ci.yml Normal file
View File

@@ -0,0 +1,97 @@
name: CI for csaxs_bec
on:
push:
pull_request:
workflow_dispatch:
inputs:
BEC_WIDGETS_BRANCH:
description: "Branch of BEC Widgets to install"
required: false
type: string
default: "main"
BEC_CORE_BRANCH:
description: "Branch of BEC Core to install"
required: false
type: string
default: "main"
OPHYD_DEVICES_BRANCH:
description: "Branch of Ophyd Devices to install"
required: false
type: string
default: "main"
BEC_PLUGIN_REPO_BRANCH:
description: "Branch of the BEC Plugin Repository to install"
required: false
type: string
default: "main"
PYTHON_VERSION:
description: "Python version to use"
required: false
type: string
default: "3.11"
permissions:
pull-requests: write
jobs:
test:
runs-on: ubuntu-latest
env:
QTWEBENGINE_DISABLE_SANDBOX: 1
QT_QPA_PLATFORM: "offscreen"
steps:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "${{ inputs.PYTHON_VERSION || '3.11' }}"
- name: Checkout BEC Core
uses: actions/checkout@v4
with:
repository: bec/bec
ref: "${{ inputs.BEC_CORE_BRANCH || 'main' }}"
path: ./bec
- name: Checkout Ophyd Devices
uses: actions/checkout@v4
with:
repository: bec/ophyd_devices
ref: "${{ inputs.OPHYD_DEVICES_BRANCH || 'main' }}"
path: ./ophyd_devices
- name: Checkout BEC Widgets
uses: actions/checkout@v4
with:
repository: bec/bec_widgets
ref: "${{ inputs.BEC_WIDGETS_BRANCH || 'main' }}"
path: ./bec_widgets
- name: Checkout BEC Plugin Repository
uses: actions/checkout@v4
with:
repository: bec/csaxs_bec
ref: "${{ inputs.BEC_PLUGIN_REPO_BRANCH || github.head_ref || github.sha }}"
path: ./csaxs_bec
- name: Install dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y libgl1 libegl1 x11-utils libxkbcommon-x11-0 libdbus-1-3 xvfb
sudo apt-get -y install libnss3 libxdamage1 libasound2t64 libatomic1 libxcursor1
- name: Install Python dependencies
shell: bash
run: |
pip install uv
uv pip install --system -e ./ophyd_devices
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 ./csaxs_bec
- name: Run Pytest with Coverage
id: coverage
run: pytest --random-order --cov=./csaxs_bec --cov-config=./csaxs_bec/pyproject.toml --cov-branch --cov-report=xml --no-cov-on-fail ./csaxs_bec/tests/ || test $? -eq 5

View File

@@ -416,7 +416,7 @@ class FlomniSampleTransferMixin:
def laser_tracker_on(self):
dev.rtx.controller.laser_tracker_on()
time.sleep(0.2)
self._laser_tracker_check_signalstrength()
dev.rtx.controller.laser_tracker_check_signalstrength()
def laser_tracker_off(self):
dev.rtx.controller.laser_tracker_off()
@@ -429,11 +429,11 @@ class FlomniSampleTransferMixin:
def feedback_enable_with_reset(self):
self.device_manager.devices.rtx.controller.feedback_enable_with_reset()
self.rt_feedback_status()
self.feedback_status()
def feedback_enable_without_reset(self):
self.device_manager.devices.rtx.controller.feedback_enable_without_reset()
self.rt_feedback_status()
self.feedback_status()
def feedback_status(self):
feedback_status = self.device_manager.devices.rtx.controller.feedback_is_running()

View File

@@ -63,6 +63,8 @@ class OmnyAlignment(BECWidget, QWidget):
self.ui.liveViewSwitch.enabled.connect(self.on_live_view_enabled)
self.ui.moveUpButton.clicked.connect(self.on_move_up)
@property
def enable_live_view(self):
@@ -102,7 +104,6 @@ class OmnyAlignment(BECWidget, QWidget):
image.disconnect_monitor("cam200")
@property
def enable_move_buttons(self):
move_up:QPushButton = self.ui.moveUpButton

View File

@@ -0,0 +1,6 @@
# Macros
This directory is intended to store macros which will be loaded automatically when starting BEC.
Macros are small functions to make repetitive tasks easier. Functions defined in python files in this directory will be accessible from the BEC console.
Please do not put any code outside of function definitions here. If you wish for code to be automatically run when starting BEC, see the startup script at csaxs_bec/bec_ipython_client/startup/post_startup.py
For a guide on writing macros, please see: https://bec.readthedocs.io/en/latest/user/command_line_interface.html#how-to-write-a-macro

View File

View File

@@ -172,7 +172,7 @@ class FlomniFermatScan(SyncFlyScanBase):
self.device_manager.connector.raise_alarm(
severity=0,
alarm_type="LaserTrackerSignalStrength",
source="rtx",
source={"device": "rtx", "reason": "low signal strength", "method": "_prepare_setup_part2"},
metadata={},
msg="Signal strength of the laser tracker is low, sufficient to continue. Realignment recommended!",
)
@@ -295,9 +295,10 @@ class FlomniFermatScan(SyncFlyScanBase):
logger.debug("reading monitors")
# yield from self.device_rpc("rtx", "controller.kickoff")
def return_to_start(self):
def move_to_start(self):
"""return to the start position"""
# in flomni, we need to move to the start position of the next scan
# in flomni, we need to move to the start position of the next scan, which is the end position of the current scan
# this method is called in finalize and overwrites the default move_to_start()
if isinstance(self.positions, np.ndarray) and len(self.positions[-1]) == 3:
yield from self.stubs.set(device=["rtx", "rty", "rtz"], value=self.positions[-1])
return

View File

@@ -280,9 +280,10 @@ class OMNYFermatScan(SyncFlyScanBase):
logger.debug("reading monitors")
# yield from self.device_rpc("rtx", "controller.kickoff")
def return_to_start(self):
def move_to_start(self):
"""return to the start position"""
# in omny, we need to move to the start position of the next scan
# in omny, we need to move to the start position of the next scan, which is the end position of the current scan
# this method is called in finalize and overwrites the default move_to_start()
if isinstance(self.positions, np.ndarray) and len(self.positions[-1]) == 3:
yield from self.stubs.set(device=["rtx", "rty", "rtz"], value=self.positions[-1])
return

View File

@@ -147,8 +147,14 @@ Following functions exist to move the optics in and out, with self-explaining na
The position feedback in flOMNI is controlled in closed loop to an interferometric position measurement. To show the signal of the interferometers:
`flomni.show_signal_strength_interferometer()`
Typical values with proper alignment, sample stage at the measurement position and laser tracker running are
_TODO_
Typical values with proper alignment, sample stage at the measurement position and laser tracker running are in the range of
| Axis | Value |
| --- | --- |
| 0 | 13681.0 |
| 1 | 12383.0 |
| 2 | 10716.0 |
| 3 | 11032.0 |
#### Laser tracker commands
@@ -162,10 +168,10 @@ The horizontal interferometer is built according to the [tracking interferometer
#### Interferometer feedback commands
The closed loop control of the Piezo stages can be controlled by
- `flomni.rt_feedback_enable_with_reset()`.
- `flomni.feedback_feedback_enable_with_reset()`.
_There is also an enable without reset, which is used during tomography scans, when using coarse stages to increase the scan range. It should not be required to use manually._
- `flomni.rt_feedback_disable()`
- `flomni.rt_feedback_status()`
- `flomni.feedback_disable()`
- `flomni.feedback_status()`
### Scanning in 2D and sample alignment