diff --git a/superxas_bec/device_configs/x10da_config_falcon_test.yaml b/superxas_bec/device_configs/x10da_config_falcon_test.yaml index 332447f..4497dc1 100644 --- a/superxas_bec/device_configs/x10da_config_falcon_test.yaml +++ b/superxas_bec/device_configs/x10da_config_falcon_test.yaml @@ -5,7 +5,7 @@ falcon: prefix: 'X10DA-SITORO:' enabled: true onFailure: raise - readoutPriority: async + readoutPriority: monitored softwareTrigger: false manip_new_trx: description: Old Sample Manipulator X-Translation diff --git a/superxas_bec/devices/falcon_direct.py b/superxas_bec/devices/falcon_direct.py index bda5a73..d86dc2b 100644 --- a/superxas_bec/devices/falcon_direct.py +++ b/superxas_bec/devices/falcon_direct.py @@ -38,15 +38,15 @@ class DXPControl(Device): input_count_rate = Cpt(EpicsSignalRO, "InputCountRate", kind=Kind.omitted, auto_monitor=True) output_count_rate = Cpt(EpicsSignalRO, "OutputCountRate", kind=Kind.omitted, auto_monitor=True) - elapsed_real_time = Cpt(EpicsSignalRO, "ElapsedRealTime", kind=Kind.omitted, auto_monitor=True) + elapsed_real_time = Cpt(EpicsSignalRO, "ElapsedRealTime", kind=Kind.omitted) class MCAControl(Device): """MCA Control Device for Falcon detector""" - spectrum = Cpt(EpicsSignalRO, ".VAL", kind=Kind.omitted, auto_monitor=True) + spectrum = Cpt(EpicsSignalRO, ".VAL", kind=Kind.omitted) roi_count = Cpt(EpicsSignalRO, ".R0", kind=Kind.omitted, auto_monitor=True) - roi_label = Cpt(EpicsSignal, ".R0NM", kind=Kind.omitted, auto_monitor=True) + roi_label = Cpt(EpicsSignal, ".R0NM", kind=Kind.omitted) elapsed_real_time = Cpt(EpicsSignalRO, ".ERTM", kind=Kind.omitted, auto_monitor=True) @@ -73,7 +73,7 @@ class DeadTimeCorrectedCounts(Signal): icr = dxp.input_count_rate.get() ocr = dxp.output_count_rate.get() - roi = mca.rois.roi0.count.get() + roi = mca.roi_count.get() ert = mca.elapsed_real_time.get() print(icr, ocr, roi, ert) @@ -115,16 +115,16 @@ class FalconControlDirect(Device): acquiring = Cpt(EpicsSignal, "Acquiring", kind=Kind.omitted, auto_monitor=True) # DXP parameters - dxp1 = Cpt(DXPControl, "dxp1:") + dxp1 = Cpt(DXPControl, "dxp1:", kind=Kind.omitted) # dxp2 = Cpt(EpicsDXPFalcon, "dxp2:") # MCA record with spectrum data - mca1 = Cpt(MCAControl, "mca1") + mca1 = Cpt(MCAControl, "mca1", kind=Kind.omitted) # mca2 = Cpt(EpicsMCARecord, "mca2") # Norm Signal dead_time_cor_cnts1 = Cpt( - DeadTimeCorrectedCounts, name="dead_time_cor_cnts", channel=1, kind=Kind.hinted + DeadTimeCorrectedCounts, name="dead_time_cor_cnts", channel=1, kind=Kind.omitted ) # dead_time_cor_cnts2 = Cpt(DeadTimeCorrectedCounts, name='dead_time_cor_cnts', channel=2, kind=Kind.normal) @@ -133,30 +133,18 @@ class FalconSuperXASDirect(PSIDeviceBase, FalconControlDirect): """Falcon implementierung at SuperXAS. prefix: 'X10DA-SITORO:'""" preview = Cpt( - Signal, name="preview", kind=Kind.omitted, doc="Preview signal for Falcon detector" + Signal, name="preview", kind=Kind.normal, doc="Preview 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" - ) + Signal, name="icr", kind=Kind.normal) + ocr = Cpt(Signal, name="icr", kind=Kind.normal) + elap_real_time = Cpt(Signal, name="icr", kind=Kind.normal) + roi0_count = Cpt(Signal, name="icr", kind=Kind.normal) dead_cor_roi0_count = Cpt( - AsyncSignal, + Signal, name="dead_cor_roi0_count", - ndim=0, - max_size=int(1e6), doc="Async dead time corrected ROI 0 count signal", + kind=Kind.normal ) ######################################## @@ -205,6 +193,8 @@ class FalconSuperXASDirect(PSIDeviceBase, FalconControlDirect): Called after the device is connected and its signals are connected. Default values for signals should be set here. """ + self.stop_all.put(1) + CompareStatus(self.acquiring, FalconAcquiringStatus.DONE).wait(5) # self.mca1.spectrum.subscribe(self._update_preview, run=False) # TODO add again once PreviewSIgnal works with GUI @@ -219,16 +209,14 @@ class FalconSuperXASDirect(PSIDeviceBase, FalconControlDirect): Information about the upcoming scan can be accessed from the scan_info (self.scan_info.msg) object. """ + self.stop_all.put(1, use_complete=True) + CompareStatus(self.acquiring, FalconAcquiringStatus.DONE).wait(self._pv_timeout) self.collect_mode.set(0).wait() self.preset_real_time.set(0).wait() - self.stop_all.put(1) - CompareStatus(self.acquiring, FalconAcquiringStatus.DONE).wait(self._pv_timeout) def on_unstage(self) -> DeviceStatus | StatusBase | None: """Called while unstaging the device.""" self.stop_all.put(1) - self.erase_all.put(1) - CompareStatus(self.acquiring, FalconAcquiringStatus.DONE).wait(self._pv_timeout) def on_pre_scan(self) -> DeviceStatus | StatusBase | None: """Called right before the scan starts on all devices automatically.""" @@ -255,37 +243,13 @@ class FalconSuperXASDirect(PSIDeviceBase, FalconControlDirect): time_started = time.time() # CompareStatus(self.acquiring, FalconAcquiringStatus.DONE).wait(self._pv_timeout) logger.info(f"Sending data for {self.name} at {time_started}") - self.icr.put( - {self.icr.name: {"value": self.dxp1.input_count_rate.get(), "timestamp": time.time()}} - ) - self.ocr.put( - {self.ocr.name: {"value": self.dxp1.output_count_rate.get(), "timestamp": time.time()}} - ) - self.elap_real_time.put( - { - self.elap_real_time.name: { - "value": self.mca1.elapsed_real_time.get(), - "timestamp": time.time(), - } - } - ) - self.roi0_count.put( - { - self.roi0_count.name: { - "value": self.mca1.rois.roi0.count.get(), - "timestamp": time.time(), - } - } - ) - self.dead_cor_roi0_count.put( - { - self.dead_cor_roi0_count.name: { - "value": self.dead_time_cor_cnts1.get(), - "timestamp": time.time(), - } - } - ) - self._send_preview_async() + self.icr.put(self.dxp1.input_count_rate.get()) + self.ocr.put(self.dxp1.output_count_rate.get()) + self.elap_real_time.put(self.mca1.elapsed_real_time.get()) + self.roi0_count.put(self.mca1.roi_count.get()) + self.dead_cor_roi0_count.put(self.dead_time_cor_cnts1.get()) + self.preview.put(self.mca1.spectrum.get()) + # self._send_preview_async() logger.info(f"Data sent for {self.name} at {time.time()- time_started}") def _send_preview_async(self) -> None: