From da9004b4873883a1a377ffd2b146f5cacf0bbab7 Mon Sep 17 00:00:00 2001 From: wakonig_k Date: Tue, 17 Jun 2025 11:08:10 +0200 Subject: [PATCH] wip --- tomcat_bec/devices/pco_edge/pcoedgecamera.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tomcat_bec/devices/pco_edge/pcoedgecamera.py b/tomcat_bec/devices/pco_edge/pcoedgecamera.py index abc5798..b80faaa 100644 --- a/tomcat_bec/devices/pco_edge/pcoedgecamera.py +++ b/tomcat_bec/devices/pco_edge/pcoedgecamera.py @@ -125,6 +125,7 @@ class PcoEdge5M(PSIDeviceBase, PcoEdgeBase): self.backend.add_count_callback(self._on_count_update) self.live_preview = None self.converted_files = deque(maxlen=100) # Store the last 10 converted files + self.target_files = deque(maxlen=100) # Store the last 10 target files self.acq_configs = {} if std_daq_live is not None: self.live_preview = StdDaqPreview(url=std_daq_live, cb=self._on_preview_update) @@ -361,6 +362,7 @@ class PcoEdge5M(PSIDeviceBase, PcoEdgeBase): num_images=self.num_images.get(), # type: ignore ) self.camera_status.set(CameraStatus.RUNNING).wait() + self.target_files.append(self.target_file) def is_running(*, value, timestamp, **_): return bool(value == CameraStatusCode.RUNNING) @@ -541,11 +543,11 @@ class PcoEdge5M(PSIDeviceBase, PcoEdgeBase): """Called to inquire if a device has completed a scans.""" def _create_dataset(_status: DeviceStatus): - if self.target_file in self.converted_files: - logger.info( - f"File {self.target_file} already exists in the converted files list. " - "Skipping dataset creation." - ) + if ( + self.target_file in self.converted_files + or self.target_file not in self.target_files + ): + logger.info(f"File {self.target_file} already processed or not in target files.") return self.backend.create_virtual_datasets( self.file_path.get(), file_prefix=self.file_prefix.get() # type: ignore