Added image shape check to stdDAQ device

This commit is contained in:
gac-x05la
2025-01-20 16:44:46 +01:00
parent e1c866fd30
commit 22e20edd71
2 changed files with 16 additions and 0 deletions

View File

@@ -151,6 +151,7 @@ gfdaq:
deviceConfig:
ws_url: 'ws://129.129.95.111:8080'
rest_url: 'http://129.129.95.111:5000'
data_source_name: 'gfcam'
deviceTags:
- std-daq
enabled: true

View File

@@ -159,6 +159,7 @@ class StdDaqClient(PSIDeviceBase):
sim_mode=False,
ws_url: str = "ws://localhost:8080",
rest_url: str = "http://localhost:5000",
data_source_name = None,
**kwargs,
) -> None:
super().__init__(prefix=prefix, name=name, kind=kind, read_attrs=read_attrs, configuration_attrs=configuration_attrs, parent=parent, device_manager=device_manager, **kwargs)
@@ -167,6 +168,7 @@ class StdDaqClient(PSIDeviceBase):
self.ws_url.set(ws_url, force=True).wait()
self.rest_url._metadata["write_access"] = False
self.rest_url.set(rest_url, force=True).wait()
self.data_source_name = data_source_name
# Connect to the DAQ and initialize values
try:
@@ -313,6 +315,19 @@ class StdDaqClient(PSIDeviceBase):
if self.state() != 'idle':
raise RuntimeError(f"[{self.name}] stdDAQ can't stage from state: {self.state()}")
# Must make sure that image size matches the data source
if self.data_source_name is not None:
cam_img_w = self.device_manager.devices[self.data_source_name].cfgRoiX.get()
cam_img_h = self.device_manager.devices[self.data_source_name].cfgRoiY.get()
daq_img_w = self.cfg_pixel_width.get()
daq_img_h = self.cfg_pixel_height.get()
if not (daq_img_w == cam_img_w and daq_img_h == cam_img_h):
raise RuntimeError(f"[{self.name}] stdDAQ image resolution ({daq_img_w} , {daq_img_h}) does not match camera with ({cam_img_w} , {cam_img_h})")
else:
logger.warning(f"[{self.name}] stdDAQ image resolution ({daq_img_w} , {daq_img_h}) matches camera with ({cam_img_w} , {cam_img_h})")
file_path = self.file_path.get()
num_images = self.num_images.get()