1
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2026-04-12 19:50:54 +02:00

Compare commits

...

7 Commits

Author SHA1 Message Date
semantic-release
8f2f42f818 1.25.1
Automatically generated by python-semantic-release
2025-03-24 19:00:20 +00:00
e5c9dd288c fix(positioner_box): if possible tweak should use the current setpoint instead of the readback 2025-03-24 15:27:32 +01:00
be274a10fc fix(positioner_box): fixed motor moving flags for spinner 2025-03-21 18:12:55 +01:00
d86ef4e763 ci: add e2e job for pre_release branches 2025-03-13 16:44:57 +01:00
6cf39b3796 ci: fix conda channels for PSI policy change 2025-03-13 16:13:44 +01:00
semantic-release
15e11b287d 1.25.0
Automatically generated by python-semantic-release
2025-03-07 15:19:37 +00:00
7cbebbb1f0 feat(waveform): add slice handling and reset functionality for async updates 2025-03-07 15:44:46 +01:00
7 changed files with 90 additions and 13 deletions

View File

@@ -197,7 +197,13 @@ end-2-end-conda:
script:
- *clone-repos
- *install-os-packages
- conda config --prepend channels conda-forge
- conda config --show-sources
- conda config --add channels conda-forge
- conda config --system --remove channels https://repo.anaconda.com/pkgs/main
- conda config --system --remove channels https://repo.anaconda.com/pkgs/r
- conda config --remove channels https://repo.anaconda.com/pkgs/main
- conda config --remove channels https://repo.anaconda.com/pkgs/r
- conda config --show-sources
- conda config --set channel_priority strict
- conda config --set always_yes yes --set changeps1 no
- conda create -q -n test-environment python=3.11
@@ -227,6 +233,7 @@ end-2-end-conda:
- if: '$CI_PIPELINE_SOURCE == "parent_pipeline"'
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main"'
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "production"'
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ /^pre_release.*$/'
semver:
stage: Deploy

View File

@@ -1,6 +1,33 @@
# CHANGELOG
## v1.25.1 (2025-03-24)
### Bug Fixes
- **positioner_box**: Fixed motor moving flags for spinner
([`be274a1`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/be274a10fc76528e1e5d6b309678c7fb4e9b890e))
- **positioner_box**: If possible tweak should use the current setpoint instead of the readback
([`e5c9dd2`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/e5c9dd288c571d29722497a2d40b000d1cffb475))
### Continuous Integration
- Add e2e job for pre_release branches
([`d86ef4e`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/d86ef4e763b321b1c82be71c9f275abb610fed06))
- Fix conda channels for PSI policy change
([`6cf39b3`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/6cf39b3796f850294705465adfaf6ad25a71461f))
## v1.25.0 (2025-03-07)
### Features
- **waveform**: Add slice handling and reset functionality for async updates
([`7cbebbb`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/7cbebbb1f00ea2e2b3678c96b183a877e59c5240))
## v1.24.5 (2025-03-06)
### Bug Fixes

View File

@@ -126,6 +126,8 @@ class BECWaveform(BECPlotBase):
"label_suffix": "",
}
self._slice_index = None
# Scan segment update proxy
self.proxy_update_plot = pg.SignalProxy(
self.scan_signal_update, rateLimit=25, slot=self._update_scan_curves
@@ -1252,7 +1254,9 @@ class BECWaveform(BECPlotBase):
x_data = None
instruction = metadata.get("async_update", {}).get("type")
max_shape = metadata.get("async_update", {}).get("max_shape", [])
for curve in self._curves_data["async"].values():
all_async_curves = self._curves_data["async"].values()
# for curve in self._curves_data["async"].values():
for curve in all_async_curves:
y_entry = curve.config.signals.y.entry
x_name = self._x_axis_mode["name"]
for device, async_data in msg["signals"].items():
@@ -1276,6 +1280,18 @@ class BECWaveform(BECPlotBase):
curve.setData(x_data, new_data)
else:
curve.setData(new_data)
elif instruction == "add_slice":
current_slice_id = metadata.get("async_update", {}).get("index")
data_plot = async_data["value"]
if current_slice_id != self._slice_index:
self._slice_index = current_slice_id
new_data = data_plot
else:
x_data, y_data = curve.get_data()
new_data = np.hstack((y_data, data_plot))
curve.setData(new_data)
elif instruction == "replace":
if x_name == "timestamp":
x_data = async_data["timestamp"]
@@ -1524,6 +1540,10 @@ class BECWaveform(BECPlotBase):
for curve_id in curve_ids_to_remove:
self.remove_curve(curve_id)
def reset(self):
self._slice_index = None
super().reset()
def clear_all(self):
sources = list(self._curves_data.keys())
for source in sources:

View File

@@ -1,6 +1,5 @@
import uuid
from abc import abstractmethod
from ast import Tuple
from typing import Callable, TypedDict
from bec_lib.device import Positioner
@@ -140,10 +139,12 @@ class PositionerBoxBase(BECWidget, CompactPopupWidget):
if setpoint_val is not None:
break
for moving_signal in ["motor_done_move", "motor_is_moving"]:
is_moving = signals.get(f"{device}_{moving_signal}", {}).get("value")
if is_moving is not None:
break
if f"{device}_motor_done_move" in signals:
is_moving = not signals[f"{device}_motor_done_move"].get("value")
elif f"{device}_motor_is_moving" in signals:
is_moving = signals[f"{device}_motor_is_moving"].get("value")
else:
is_moving = None
if is_moving is not None:
spinner.setVisible(True)

View File

@@ -1,4 +1,4 @@
""" Module for a PositionerBox widget to control a positioner device."""
"""Module for a PositionerBox widget to control a positioner device."""
from __future__ import annotations
@@ -212,12 +212,34 @@ class PositionerBox(PositionerBoxBase):
@SafeSlot()
def on_tweak_right(self):
"""Tweak motor right"""
self.dev[self.device].move(self.step_size, relative=True)
setpoint = self._get_setpoint()
if setpoint is None:
self.dev[self.device].move(self.step_size, relative=True)
return
target = setpoint + self.step_size
self.dev[self.device].move(target, relative=False)
@SafeSlot()
def on_tweak_left(self):
"""Tweak motor left"""
self.dev[self.device].move(-self.step_size, relative=True)
setpoint = self._get_setpoint()
if setpoint is None:
self.dev[self.device].move(-self.step_size, relative=True)
return
target = setpoint - self.step_size
self.dev[self.device].move(target, relative=False)
def _get_setpoint(self) -> float | None:
"""Get the setpoint of the motor"""
setpoint = getattr(self.dev[self.device], "setpoint", None)
if not setpoint:
setpoint = getattr(self.dev[self.device], "user_setpoint", None)
if not setpoint:
return None
try:
return float(setpoint.get())
except Exception:
return None
@SafeSlot()
def on_setpoint_change(self):

View File

@@ -23,8 +23,8 @@ class SpinnerWidget(QWidget):
self.timer = QTimer(self)
self.timer.timeout.connect(self.rotate)
self.time = 0
self.duration = 50
self.speed = 50
self.duration = 40
self.speed = 40
self._started = False
def start(self):

View File

@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "bec_widgets"
version = "1.24.5"
version = "1.25.1"
description = "BEC Widgets"
requires-python = ">=3.10"
classifiers = [