0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-14 03:31:50 +02:00

fix: accept scalars or numpy arrays of 1 element

This commit is contained in:
2024-05-29 17:02:23 +02:00
committed by wyzula-jan
parent 69f4371007
commit 2a88e17b23
3 changed files with 4 additions and 4 deletions

View File

@ -317,7 +317,7 @@ class BECMotorMap(BECPlotBase):
Returns: Returns:
float: Motor initial position. 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 return init_position
def _validate_signal_entries( def _validate_signal_entries(
@ -403,7 +403,7 @@ class BECMotorMap(BECPlotBase):
# Update plot title # Update plot title
precision = self.config.precision precision = self.config.precision
self.set_title( 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) @pyqtSlot(dict)

View File

@ -577,7 +577,6 @@ class BECWaveform(BECPlotBase):
Returns: Returns:
dict | pd.DataFrame: Data of all curves in the specified format. dict | pd.DataFrame: Data of all curves in the specified format.
""" """
data = {} data = {}
try: try:
import pandas as pd import pandas as pd

View File

@ -115,7 +115,8 @@ class Ring(BECConnector):
def set_value(self, value: int | float): def set_value(self, value: int | float):
self.config.value = round( 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): def set_color(self, color: str | tuple):