Correct signal name for rle compression stats #82

Merged
hitz_s merged 2 commits from fix/pilatus-and-nexus-structure into main 2026-06-15 07:46:09 +02:00
2 changed files with 13 additions and 12 deletions
+12 -11
View File
@@ -278,17 +278,17 @@ class Pilatus(PSIDeviceBase, ADBase):
height = self.image1.array_size.height.get()
# Geometry correction for the image
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 np.array_equal(data, last_image.data):
# No update if image is the same, ~2.5ms on 2400x2400 image (6M)
logger.debug(
f"Pilatus preview image for {self.name} is the same as last one, not updating."
)
continue
# if last_image is not None:
# if np.array_equal(data, last_image.data):
# # No update if image is the same, ~2.5ms on 2400x2400 image (6M)
# logger.info(
# f"Pilatus preview image for {self.name} is the same as last one, not updating."
# )
# continue
logger.debug(f"Setting preview data for {self.name}")
logger.info(f"Setting preview data for {self.name}")
self.preview.put(data)
except Exception: # pylint: disable=broad-except
content = traceback.format_exc()
@@ -452,6 +452,7 @@ class Pilatus(PSIDeviceBase, ADBase):
Called after the device is connected and its signals are connected.
Default values for signals should be set here.
"""
self.hdf.warmup()
status_cam = CompareStatus(self.cam.acquire, ACQUIREMODE.DONE.value)
status_hdf = CompareStatus(self.hdf.capture, ACQUIREMODE.DONE.value)
@@ -517,6 +518,7 @@ class Pilatus(PSIDeviceBase, ADBase):
self.scan_parameters.num_monitored_readouts
* self.scan_parameters.frames_per_trigger
)
logger.info(self.scan_parameters)
exp_time = self.scan_parameters.exp_time
self.trigger_source.set(MONOTRIGGERSOURCE.EPICS).wait(5)
self.trigger_n_of.set(1).wait(5) # BEC will trigger each acquisition
@@ -546,7 +548,7 @@ class Pilatus(PSIDeviceBase, ADBase):
self.hdf.enable.set(1).wait(5) # Enable HDF5 plugin
# Camera settings
self.cam.num_exposures.set(1).wait(5)
self.cam.num_images.set(self.n_images).wait(5)
self.cam.num_images.set(self.n_images, timeout=5).wait()
self.cam.acquire_time.set(detector_exp_time).wait(5) # let's try this
self.cam.acquire_period.set(exp_time).wait(5)
self.filter_number.set(0).wait(5)
@@ -661,7 +663,6 @@ class Pilatus(PSIDeviceBase, ADBase):
"""Called when the device is destroyed. Cleanup resources here."""
self._poll_thread_kill_event.set()
# TODO do we need to clean the poll thread ourselves?
self.on_stop()
if __name__ == "__main__":
@@ -236,7 +236,7 @@ class DebyeNexusStructure(DefaultFormat):
self.configuration.get("nidaq", {}).get("nidaq_add_chans", {}).get("value")
)
rle = self.configuration.get("nidaq", {}).get("nidaq_rle", {}).get("value")
rle = self.configuration.get("nidaq", {}).get("nidaq_enable_compression", {}).get("value")
measurement_mode = entry.create_group(name="mode")
measurement_mode.attrs["NX_class"] = "NX_CHAR"