ScanControl: FermatSpiral scan do not work
The scan cannot be reconstructed from the previously executed parameters and cannot be launched.
There are two issues:
-
Incorrect Device Reading in
scan_group_box.py
During Launch: A device reading error is occurring inscan_group_box.py
. The_get_kwarg_parameters
method needs to correctly retrieve device or widget values based on their types.def _get_kwarg_parameters(self, device_object: bool = True): kwargs = {} for i in range(self.layout.columnCount()): widget = self.layout.itemAtPosition(1, i).widget() if isinstance(widget, DeviceLineEdit) and device_object: value = widget.get_device() else: value = WidgetIO.get_value(widget) kwargs[widget.arg_name] = value return kwargs
-
Inconsistent Signature in
FermatSpiralScan
in BEC: TheFermatSpiralScan
signature implies that all parameters are treated as keyword arguments (kwargs
), without positional arguments (args bundle), which is not accurate. The scan description message indicates the use of both positional arguments and keyword arguments:class FermatSpiralScan(ScanBase): scan_name = "fermat_scan" required_kwargs = ["step", "relative"] gui_config = { "Device 1": ["motor1", "start_motor1", "stop_motor1"], "Device 2": ["motor2", "start_motor2", "stop_motor2"], "Movement Parameters": ["step", "relative"], "Acquisition Parameters": ["exp_time", "settling_time", "burst_at_each_point"], } def __init__( self, motor1: DeviceBase, start_motor1: float, stop_motor1: float, motor2: DeviceBase, start_motor2: float, stop_motor2: float, step: float = 0.1, exp_time: float = 0, settling_time: float = 0, relative: bool = False, burst_at_each_point: int = 1, spiral_type: float = 0, optim_trajectory: Literal["corridor", None] = None, **kwargs, ): """ A scan following Fermat's spiral. Args: motor1 (DeviceBase): First motor start_motor1 (float): Start position for motor 1 stop_motor1 (float): Stop position for motor 1 motor2 (DeviceBase): Second motor start_motor2 (float): Start position for motor 2 stop_motor2 (float): Stop position for motor 2 step (float): Step size in motor units. Default is 0.1. exp_time (float): Exposure time in seconds. Default is 0. settling_time (float): Settling time in seconds. Default is 0. relative (bool): If True, motors move relative to the current position. Default is False. burst_at_each_point (int): Number of exposures per point. Default is 1. spiral_type (float): Type of spiral to use. Default is 0. optim_trajectory (str): Trajectory optimization method. Default is None. Options are "corridor" and None. Returns: ScanReport """
Based on the scan message content, both positional and keyword arguments are expected in the scan request:
scan.content["info"]["request_blocks"][-1]["msg"].content["parameter"] Out[1]: {'args': ['samy', -5, 5, 'samy', -5, 5], 'kwargs': {'step': 0.5, 'exp_time': 0.1, 'relative': True, 'optim_trajectory': 'corridor', 'system_config': {'file_suffix': None, 'file_directory': None}}}