updates beamline test scripts
This commit is contained in:
@@ -36,18 +36,18 @@ class FalconAcquiringStatus(int, enum.Enum):
|
||||
class DXPControl(Device):
|
||||
"""DXP Control Device for Falcon detector"""
|
||||
|
||||
input_count_rate = Cpt(EpicsSignalRO, "InputCountRate", kind=Kind.omitted, auto_monitor=True)
|
||||
output_count_rate = Cpt(EpicsSignalRO, "OutputCountRate", kind=Kind.omitted, auto_monitor=True)
|
||||
input_count_rate = Cpt(EpicsSignalRO, "InputCountRate", kind=Kind.omitted)
|
||||
output_count_rate = Cpt(EpicsSignalRO, "OutputCountRate", kind=Kind.omitted)
|
||||
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)
|
||||
roi_count = Cpt(EpicsSignalRO, ".R0", 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)
|
||||
spectrum = Cpt(EpicsSignalRO, ".VAL", kind=Kind.omitted)
|
||||
roi0_count = Cpt(EpicsSignalRO, ".R0", kind=Kind.omitted)
|
||||
roi0_label = Cpt(EpicsSignal, ".R0NM", kind=Kind.omitted)
|
||||
elapsed_real_time = Cpt(EpicsSignalRO, ".ERTM", kind=Kind.omitted)
|
||||
|
||||
|
||||
class DeadTimeCorrectedCounts(Signal):
|
||||
@@ -213,7 +213,7 @@ class FalconSuperXASDirect(PSIDeviceBase, FalconControlDirect):
|
||||
# self.stop_all.put(1, use_complete=True)
|
||||
if self.acquiring.get() == FalconAcquiringStatus.ACQUIRING:
|
||||
status = CompareStatus(self.acquiring, FalconAcquiringStatus.DONE)
|
||||
self.stop_all.put(1)
|
||||
self.stop_all.set(1).wait(self._pv_timeout)
|
||||
try:
|
||||
status.wait(self._pv_timeout)
|
||||
except Exception as exc:
|
||||
@@ -225,7 +225,7 @@ class FalconSuperXASDirect(PSIDeviceBase, FalconControlDirect):
|
||||
|
||||
def on_unstage(self) -> DeviceStatus | StatusBase | None:
|
||||
"""Called while unstaging the device."""
|
||||
self.stop_all.put(1)
|
||||
self.stop_all.set(1).wait(self._pv_timeout)
|
||||
|
||||
def on_pre_scan(self) -> DeviceStatus | StatusBase | None:
|
||||
"""Called right before the scan starts on all devices automatically."""
|
||||
@@ -241,7 +241,7 @@ class FalconSuperXASDirect(PSIDeviceBase, FalconControlDirect):
|
||||
|
||||
def on_stop(self) -> None:
|
||||
"""Called when the device is stopped."""
|
||||
self.stop_all.put(1)
|
||||
self.stop_all.set(1).wait(self._pv_timeout)
|
||||
|
||||
def send_data(self):
|
||||
"""
|
||||
@@ -257,7 +257,7 @@ class FalconSuperXASDirect(PSIDeviceBase, FalconControlDirect):
|
||||
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.dead_cor_roi0_count.put(self.dead_time_cor_cnts1.get())
|
||||
self._send_preview_async()
|
||||
logger.info(f"Data sent for {self.name} at {time.time()- time_started}")
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import time
|
||||
import epics
|
||||
|
||||
import numpy as np
|
||||
from ophyd_devices import CompareStatus, TransitionStatus
|
||||
|
||||
from superxas_bec.devices.falcon import FalconAcquiringStatus, FalconSuperXAS
|
||||
from superxas_bec.devices.falcon_direct import FalconAcquiringStatus, FalconControlDirect as FalconSuperXAS
|
||||
from superxas_bec.devices.trigger import ContinuousSamplingMode, SamplingDone, Trigger
|
||||
|
||||
|
||||
@@ -13,9 +14,15 @@ def mock_motor_move(pos: float) -> None:
|
||||
# time.sleep(0.5)
|
||||
print(f"Mock Motor has reached the target position {pos}")
|
||||
|
||||
def sleep_poll(total_sleep:float):
|
||||
sleep_timer = 0.01
|
||||
# time.sleep(total_sleep)
|
||||
for ii in range(int(total_sleep/sleep_timer)):
|
||||
time.sleep(sleep_timer)
|
||||
epics.poll()
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
# time.sleep(20) # Give time to connect pyspy
|
||||
# Exposure time 0.6s
|
||||
exp_time = 0.6
|
||||
# steps = 10
|
||||
@@ -62,21 +69,29 @@ if __name__ == "__main__":
|
||||
falcon.erase_start.put(1)
|
||||
print(f"Acquiring state after erase_start: {FalconAcquiringStatus(falcon.acquiring.get())}")
|
||||
status.wait(timeout=5)
|
||||
time.sleep(0.4)
|
||||
sleep_poll(0.4)
|
||||
# time.sleep(0.4)
|
||||
status_smpl = TransitionStatus(
|
||||
trigger.smpl_done, [SamplingDone.RUNNING, SamplingDone.DONE]
|
||||
)
|
||||
trigger.smpl.put(1)
|
||||
status_smpl.wait()
|
||||
time.sleep(0.4)
|
||||
sleep_poll(0.4)
|
||||
# time.sleep(0.4)
|
||||
status = CompareStatus(falcon.acquiring, FalconAcquiringStatus.DONE)
|
||||
falcon.stop_all.put(1)
|
||||
status.wait(timeout=5)
|
||||
time.sleep(0.4) # Simulate some processing time
|
||||
print(falcon.mca1.rois.roi0.count.get())
|
||||
print(falcon.mca1.elapsed_live_time.get())
|
||||
sleep_poll(0.4)
|
||||
# time.sleep(0.4) # Simulate some processing time
|
||||
# print(falcon.mca1.rois.roi0.count.get())
|
||||
print(falcon.mca1.roi0_count.get())
|
||||
print(falcon.mca1.elapsed_real_time.get())
|
||||
print(falcon.max_elapsed_live.get())
|
||||
print(falcon.max_elapsed_real.get())
|
||||
time.sleep(2) # #FIXME <- When removed, crashes always in second loop! Otherwise, it soemtimes works..
|
||||
print(falcon.dxp1.input_count_rate.get())
|
||||
print(falcon.dxp1.output_count_rate.get())
|
||||
# print(falcon.mca1.elapsed_real_time.get())
|
||||
# print(falcon.max_elapsed_live.get())
|
||||
# print(falcon.max_elapsed_real.get())
|
||||
sleep_poll(2)
|
||||
# time.sleep(2) # #FIXME <- When removed, crashes always in second loop! Otherwise, it soemtimes works..
|
||||
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ def main():
|
||||
XMAPAcquiring.add_callback(acquiring_cb)
|
||||
|
||||
# Measurement loop
|
||||
for i in range(25):
|
||||
for i in range(500):
|
||||
acquire_started.clear()
|
||||
acquire_stopped.clear()
|
||||
trigger_done.clear()
|
||||
|
||||
Reference in New Issue
Block a user