This commit is contained in:
2025-06-17 11:08:10 +02:00
parent 5699363acf
commit da9004b487

View File

@@ -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