hkl scan fix
CI for addams_bec / test (push) Successful in 33s

This commit is contained in:
Xiaoqiang Wang
2026-05-09 11:28:55 +02:00
parent 2d256fca04
commit 844c73a75f
2 changed files with 37 additions and 28 deletions
+22 -16
View File
@@ -16,22 +16,12 @@ logger = bec_logger.logger
class HklFlyScan(AsyncFlyScanBase):
scan_name = 'hkl_flyscan'
scan_type = 'fly'
arg_input = {
'diffractometer': ScanArgType.DEVICE,
'controller': ScanArgType.DEVICE,
'start': ScanArgType.LIST,
'stop': ScanArgType.LIST,
'points': ScanArgType.INT
}
arg_bundle_size = {"bundle": len(arg_input), "min": 1, "max": None}
required_kwargs = []
required_kwargs = ['exp_time']
use_scan_progress_report = False
def __init__(self, diffract:Positioner, controller:DeviceBase, start:list[float], stop:list[float], points:int, optimize_profile=True, **kwargs):
self.diffract = diffract
self.controller = controller
self.start = start
self.stop = stop
def __init__(self, hstart, hstop, kstart, kstop, lstart, lstop, points, optimize_profile=True, **kwargs):
self.start = [hstart, kstart, lstart]
self.stop = [hstop, kstop, lstop]
self.points = points
self.optimize_profile = optimize_profile
super().__init__(**kwargs)
@@ -43,7 +33,23 @@ class HklFlyScan(AsyncFlyScanBase):
return self.diffract
def update_scan_motors(self):
self.scan_motors = self.device_manager.devices[self.diffract].real_axes.get()
#self.scan_motors = self.device_manager.devices[self.diffract].real_axes.get()
if 'x04v' in self.device_manager.devices:
self.diffract = 'x04v'
elif 'x04h' in self.device_manager.devices:
self.diffract = 'x04h'
else:
raise ValueError('Neither x04v nor x04h found in devices')
if 'profileMove' in self.device_manager.devices:
self.controller = 'profileMove'
else:
raise ValueError('profileMove controller not found in devices')
self.scan_motors = {
'x04v': ['ov', 'alp', 'delta', 'gam', 'nu'],
'x04h': ['oh', 'phi', 'delta', 'gam', 'nu']
}[self.diffract]
def prepare_positions(self):
"""
@@ -136,7 +142,7 @@ class HklFlyScan(AsyncFlyScanBase):
logger.success(f'{self.scan_name} finished')
def _publish_readbacks(self, device, readbacks):
metadata = {"async_update": "append", "num_lines": len(readbacks)}
metadata = {"async_update": {"type": "add", "max_shape": [len(readbacks)]}}
msg = messages.DeviceMessage(
signals={device: {'value': readbacks} }, metadata=metadata
)
+15 -12
View File
@@ -37,25 +37,28 @@ logger = bec_logger.logger
class HklScan(ScanBase):
scan_name = 'hkl_scan'
required_kwargs = ['exp_time']
arg_input = {
'diffractometer': ScanArgType.DEVICE,
'start': ScanArgType.LIST,
'stop': ScanArgType.LIST,
'points': ScanArgType.INT
}
arg_bundle_size = {"bundle": len(arg_input), "min": 1, "max": None}
def __init__(self, diffract, start, stop, points, **kwargs):
self.diffract = diffract
self.start = start
self.stop = stop
def __init__(self, hstart, hstop, kstart, kstop, lstart, lstop, points, **kwargs):
self.start = [hstart, kstart, lstart]
self.stop = [hstop, kstop, lstop]
self.points = points
super().__init__(**kwargs)
self.scan_report_devices = ['h', 'k', 'l'] + self.scan_motors + self.readout_priority['monitored']
def update_scan_motors(self):
self.scan_motors = self.device_manager.devices[self.diffract].real_axes.get()
#self.scan_motors = self.device_manager.devices[self.diffract].real_axes.get()
if 'x04v' in self.device_manager.devices:
self.diffract = 'x04v'
elif 'x04h' in self.device_manager.devices:
self.diffract = 'x04h'
else:
raise ValueError('Neither x04v nor x04h found in devices')
self.scan_motors = {
'x04v': ['ov', 'alp', 'delta', 'gam', 'nu'],
'x04h': ['oh', 'phi', 'delta', 'gam', 'nu']
}[self.diffract]
def prepare_positions(self):
"""