From 2a88e17b23436c55d25b7d3449e4af3a7689661c Mon Sep 17 00:00:00 2001 From: Mathias Guijarro Date: Wed, 29 May 2024 17:02:23 +0200 Subject: [PATCH] fix: accept scalars or numpy arrays of 1 element --- bec_widgets/widgets/figure/plots/motor_map/motor_map.py | 4 ++-- bec_widgets/widgets/figure/plots/waveform/waveform.py | 1 - bec_widgets/widgets/spiral_progress_bar/ring.py | 3 ++- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bec_widgets/widgets/figure/plots/motor_map/motor_map.py b/bec_widgets/widgets/figure/plots/motor_map/motor_map.py index 3d865ef9..46f6afdc 100644 --- a/bec_widgets/widgets/figure/plots/motor_map/motor_map.py +++ b/bec_widgets/widgets/figure/plots/motor_map/motor_map.py @@ -317,7 +317,7 @@ class BECMotorMap(BECPlotBase): Returns: float: Motor initial position. """ - init_position = round(self.dev[name].read()[entry]["value"], precision) + init_position = round(float(self.dev[name].read()[entry]["value"]), precision) return init_position def _validate_signal_entries( @@ -403,7 +403,7 @@ class BECMotorMap(BECPlotBase): # Update plot title precision = self.config.precision self.set_title( - f"Motor position: ({round(current_x,precision)}, {round(current_y,precision)})" + f"Motor position: ({round(float(current_x),precision)}, {round(float(current_y),precision)})" ) @pyqtSlot(dict) diff --git a/bec_widgets/widgets/figure/plots/waveform/waveform.py b/bec_widgets/widgets/figure/plots/waveform/waveform.py index 46f75878..cf0a59f3 100644 --- a/bec_widgets/widgets/figure/plots/waveform/waveform.py +++ b/bec_widgets/widgets/figure/plots/waveform/waveform.py @@ -577,7 +577,6 @@ class BECWaveform(BECPlotBase): Returns: dict | pd.DataFrame: Data of all curves in the specified format. """ - data = {} try: import pandas as pd diff --git a/bec_widgets/widgets/spiral_progress_bar/ring.py b/bec_widgets/widgets/spiral_progress_bar/ring.py index aed3dd6e..3b5d0ad5 100644 --- a/bec_widgets/widgets/spiral_progress_bar/ring.py +++ b/bec_widgets/widgets/spiral_progress_bar/ring.py @@ -115,7 +115,8 @@ class Ring(BECConnector): def set_value(self, value: int | float): self.config.value = round( - max(self.config.min_value, min(self.config.max_value, value)), self.config.precision + float(max(self.config.min_value, min(self.config.max_value, value))), + self.config.precision, ) def set_color(self, color: str | tuple):