This commit is contained in:
2025-09-08 09:33:58 +02:00
parent 8379aeacf6
commit be24c018d1

View File

@@ -178,9 +178,9 @@ class Pilatus(PSIDeviceBase, ADBase):
) )
self._poll_thread_kill_event = threading.Event() self._poll_thread_kill_event = threading.Event()
self._poll_rate = 1 # Poll rate in Hz self._poll_rate = 1 # Poll rate in Hz
self._live_mode_thread = threading.Thread( # self._live_mode_thread = threading.Thread(
target=self._live_mode_loop, daemon=True, name=f"{self.name}_live_mode_thread" # target=self._live_mode_loop, daemon=True, name=f"{self.name}_live_mode_thread"
) # )
# self._live_mode_kill_event = threading.Event() # self._live_mode_kill_event = threading.Event()
# self._live_mode_run_event = threading.Event() # self._live_mode_run_event = threading.Event()
# self._live_mode_stopped_event = threading.Event() # self._live_mode_stopped_event = threading.Event()
@@ -194,6 +194,7 @@ class Pilatus(PSIDeviceBase, ADBase):
"""Poll the array data for preview updates.""" """Poll the array data for preview updates."""
while not self._poll_thread_kill_event.wait(1 / self._poll_rate): while not self._poll_thread_kill_event.wait(1 / self._poll_rate):
try: try:
logger.info(f"Running poll loop for {self.name}..")
value = self.image1.array_data.get() value = self.image1.array_data.get()
if value is None: if value is None:
continue continue
@@ -202,7 +203,7 @@ class Pilatus(PSIDeviceBase, ADBase):
# Geometry correction for the image # Geometry correction for the image
data = np.reshape(value, (height, width)) data = np.reshape(value, (height, width))
last_image: DevicePreviewMessage = self.preview.get() last_image: DevicePreviewMessage = self.preview.get()
logger.info(f"Preview image for {self.name} has shape {data.shape}")
if last_image is not None: if last_image is not None:
if np.array_equal(data, last_image.data): if np.array_equal(data, last_image.data):
# No update if image is the same, ~2.5ms on 2400x2400 image (6M) # No update if image is the same, ~2.5ms on 2400x2400 image (6M)