From ccbbf5b9a9ab164f98ca6b621f62d67b1e90e8d6 Mon Sep 17 00:00:00 2001 From: gac-x10da Date: Tue, 19 Mar 2019 11:34:10 +0100 Subject: [PATCH] Script execution --- script/PumpProbeXES_W1_v2.py | 162 +++++++++++++++++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 script/PumpProbeXES_W1_v2.py diff --git a/script/PumpProbeXES_W1_v2.py b/script/PumpProbeXES_W1_v2.py new file mode 100644 index 0000000..4728571 --- /dev/null +++ b/script/PumpProbeXES_W1_v2.py @@ -0,0 +1,162 @@ +import ch.psi.pshell.epics.ChannelDouble as ChannelDouble +import ch.psi.pshell.epics.ChannelDoubleArray as ChannelDoubleArray + +#Script imported from: XES_W1.xml + +#Pre-actions +caput('X10DA-ES1:START-CSMPL', '0') +sleep(0.1) +caput('X10DA-ES1:TOTAL-CYCLES', '1') +sleep(0.1) +caput('X10DA-PILATUS-1:cam1:AcquireTime', '1') +caput('X10DA-PILATUS-1:cam1:AcquirePeriod', '1.1') +caput('X10DA-ES1-MA1:TRX.VAL', '-18') +caput('X10DA-ES1-MA1:TRX1.VAL', '-15') + +ROI1size=487 +ROI2size=487 + +#TODO: Set the diplay names of positioners and detectors + +#Creating channels: dimension 1 +#PseudoPositioner Pseudo +#ScalarDetector SAI01-MEAN +SAI01 = ChannelDouble('X10DA-ES1-SAI_01:MEAN') +#ScalarDetector SAI02 +SAI02 = ChannelDouble('X10DA-ES1-SAI_02:MEAN') +#ScalarDetector Ring-current +RingCurrent = ChannelDouble('ARIDI-PCT:CURRENT') +#ScalarDetector PilExpTime +PilExpTime = ChannelDouble('X10DA-PILATUS-1:cam1:AcquireTime_RBV') +#Timestamp Timestamp +#ScalarDetector PilFileNum +PilFileNum = ChannelDouble('X10DA-PILATUS-1:cam1:FileNumber_RBV') +#ScalarDetector TotalCounts +TotalCounts = ChannelDouble('X10DA-PILATUS-1:Stats1:Total_RBV') +#ScalarDetector TiffFileNumber +TiffFileNumber = ChannelDouble('X10DA-PILATUS-1:Magick1:FileNumber_RBV') +#ScalarDetector ROI4 +ROI4 = ChannelDouble('X10DA-PILATUS-1:Stats4:Total_RBV') +#ArrayDetector ROI1 +ROI1 = ChannelDoubleArray('X10DA-PILATUS-1:Stats1:ProfileCursorX_RBV', ROI1size) +#ArrayDetector ROI2 +ROI2 = ChannelDoubleArray('X10DA-PILATUS-1:Stats2:ProfileCursorX_RBV', ROI2size) + + + + +detectors = [SAI01, SAI02, RingCurrent, PilExpTime, PilFileNum, TotalCounts, TiffFileNumber, TiffFileNumber, ROI4, ROI1, ROI2] + + +def before_sample(): + caputq('X10DA-PILATUS-1:cam1:Acquire', 1) + caputq('X10DA-ES1:SMPL', '1') + sleep(0.1) + cawait('X10DA-PILATUS-1:cam1:Acquire', 0, type = 'l') + cawait('X10DA-ES1:SMPL-DONE', 1, type = 'l') + sleep(0.1) + +try: + tscan(detectors, 30, 0.001, before_read = before_sample) +finally: + for det in detectors: + det.close() + + + + +""" + +#Dimension 1 +#PseudoPositioner Pseudo +for setpoint1 in range(0, 30): + readback1 = setpoint1 + #Detector SAI01-MEAN + #Detector X10DA-ES1-SAI_01:MEAN pre-actions + + caputq('X10DA-PILATUS-1:cam1:Acquire', 1) + caputq('X10DA-ES1:SMPL', '1') + sleep(0.1) + cawait('X10DA-PILATUS-1:cam1:Acquire', 0, type = 'l') + cawait('X10DA-ES1:SMPL-DONE', 1, type = 'l') + sleep(0.1) + + detector1On = SAI01.get() + #Detector SAI02 + detector2On = SAI02.get() + #Detector Ring-current + detector3On = RingCurrent.get() + #Detector PilExpTime + detector4On = PilExpTime.get() + #Detector Timestamp + detector5On = float(java.lang.System.currentTimeMillis()) + #Detector PilFileNum + detector6On = PilFileNum.get() + #Detector TotalCounts + detector7On = TotalCounts.get() + #Detector TiffFileNumber + detector8On = TiffFileNumber.get() + #Detector ROI4 + detector9On = ROI4.get() + #Detector ROI1 + detector10On = ROI1.get() + #Detector ROI2 + detector11On = ROI2.get() + + + + + caputq('X10DA-PILATUS-1:cam1:Acquire', 1) + caputq('X10DA-ES1:SMPL', '1') + sleep(0.1) + cawait('X10DA-PILATUS-1:cam1:Acquire', 0, type = 'l') + cawait('X10DA-ES1:SMPL-DONE', 1, type = 'l') + sleep(0.1) + + detector1Off = SAI01.get() + #Detector SAI02 + detector2Off = SAI02.get() + #Detector Ring-current + detector3Off = RingCurrent.get() + #Detector PilExpTime + detector4Off = PilExpTime.get() + #Detector Timestamp + detector5Off = float(java.lang.System.currentTimeMillis()) + #Detector PilFileNum + detector6Off = PilFileNum.get() + #Detector TotalCounts + detector7Off = TotalCounts.get() + #Detector TiffFileNumber + detector8Off = TiffFileNumber.get() + #Detector ROI4 + detector9Off = ROI4.get() + #Detector ROI1 + detector10Off = ROI1.get() + #Detector ROI2 + detector11Off = ROI2.get() + + + detector9Diff=detector9On-detector9Off + detector10Diff=detector10On; + detector11Diff=detector11On; + detector10Diff=arrsub(detector10On, detector10Off) + detector11Diff=arrsub(detector11On, detector11Off) + + scan.append ([setpoint1], [readback1], [detector1On, detector1Off, detector2On, detector2Off, detector3On, detector3Off, detector4On, detector4Off, detector5On, detector5Off, detector6On,detector6Off, detector7On, detector7Off, detector8On, detector8Off, detector9On, detector9Off, detector10On, detector10Off, detector11On, detector11Off,detector9Diff,detector10Diff,detector11Diff]) + + + +#Closing channels +SAI01.close() +SAI02.close() +RingCurrent.close() +PilExpTime.close() +PilFileNum.close() +TotalCounts.close() +TiffFileNumber.close() +ROI4.close() +ROI1.close() +ROI2.close() + +scan.end() +""" \ No newline at end of file