From bf02475d5ec3bc2b2691decfd7dd11c74fd19a63 Mon Sep 17 00:00:00 2001 From: appel_c Date: Wed, 18 Jun 2025 09:02:29 +0200 Subject: [PATCH] fix async send data --- superxas_bec/devices/falcon_direct.py | 89 +++++++++++++++++++-------- 1 file changed, 64 insertions(+), 25 deletions(-) diff --git a/superxas_bec/devices/falcon_direct.py b/superxas_bec/devices/falcon_direct.py index e340995..d9a35f6 100644 --- a/superxas_bec/devices/falcon_direct.py +++ b/superxas_bec/devices/falcon_direct.py @@ -150,8 +150,28 @@ class FalconSuperXASDirect(PSIDeviceBase, FalconControlDirect): """Falcon implementierung at SuperXAS. prefix: 'X10DA-SITORO:'""" preview = Cpt(PreviewSignal, name="preview", ndim=1, doc="Preview signal for Falcon detector") - async_data = Cpt( - AsyncSignal, ndim=0, max_size=int(1e6), doc="Asynchronous data signal for Falcon detector" + icr = Cpt( + AsyncSignal, name="icr", ndim=0, max_size=int(1e6), doc="Async input count rate signal" + ) + ocr = Cpt( + AsyncSignal, name="ocr", ndim=0, max_size=int(1e6), doc="Async output count rate signal" + ) + elap_real_time = Cpt( + AsyncSignal, + name="elap_real_time", + ndim=0, + max_size=int(1e6), + doc="Async elapsed real time signal", + ) + roi0_count = Cpt( + AsyncSignal, name="roi0_count", ndim=0, max_size=int(1e6), doc="Async ROI 0 count signal" + ) + dead_cor_roi0_count = Cpt( + AsyncSignal, + name="dead_cor_roi0_count", + ndim=0, + max_size=int(1e6), + doc="Async dead time corrected ROI 0 count signal", ) ######################################## @@ -237,26 +257,45 @@ class FalconSuperXASDirect(PSIDeviceBase, FalconControlDirect): This method blocks until the acquiring status is DONE. """ CompareStatus(self.acquiring, FalconAcquiringStatus.DONE).wait(self._pv_timeout) - data = { - self.mca1.rois.roi0.count.name: { - "value": self.mca1.rois.roi0.count.get(), - "timestamp": time.time(), - }, - self.mca1.elapsed_real_time.name: { - "value": self.mca1.elapsed_real_time.get(), - "timestamp": time.time(), - }, - self.dxp1.input_count_rate.name: { - "value": self.dxp1.input_count_rate.get(), - "timestamp": time.time(), - }, - self.dxp1.output_count_rate.name: { - "value": self.dxp1.output_count_rate.get(), - "timestamp": time.time(), - }, - self.dead_time_cor_cnts1.name: { - "value": self.dead_time_cor_cnts1.get(), - "timestamp": time.time(), - }, - } - self.async_data.put(data) + logger.info(f"Sending data for {self.name} at {time.time()}") + self.icr.put( + { + self.dxp1.input_count_rate.name: { + "value": self.dxp1.input_count_rate.get(), + "timestamp": time.time(), + } + } + ) + self.ocr.put( + { + self.dxp1.output_count_rate.name: { + "value": self.dxp1.output_count_rate.get(), + "timestamp": time.time(), + } + } + ) + self.elap_real_time.put( + { + self.mca1.elapsed_real_time.name: { + "value": self.mca1.elapsed_real_time.get(), + "timestamp": time.time(), + } + } + ) + self.roi0_count.put( + { + self.mca1.rois.roi0.count.name: { + "value": self.mca1.rois.roi0.count.get(), + "timestamp": time.time(), + } + } + ) + self.dead_cor_roi0_count.put( + { + self.dead_time_cor_cnts1.name: { + "value": self.dead_time_cor_cnts1.get(), + "timestamp": time.time(), + } + } + ) + logger.info(f"Data sent for {self.name} at {time.time()}")