diff --git a/script/daq/PumpProbeXES_W1.py b/script/daq/PumpProbeXES_W1.py new file mode 100644 index 0000000..7691082 --- /dev/null +++ b/script/daq/PumpProbeXES_W1.py @@ -0,0 +1,136 @@ +#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 +scan = ManualScan(['Pseudo'], ['SAI01-MEAN_On','SAI01-MEAN_off', 'SAI02_On','SAI02_off', 'Ring-current_On','Ring-current_off', 'PilExpTime_On','PilExpTime_off', 'Timestamp_On','Timestamp_off', 'PilFileNum_On', 'PilFileNum_Off', 'TotalCounts_On','TotalCounts_Off', 'TiffFileNumber_On', 'TiffFileNumber_ff', 'ROI4_On','ROI4_Off', 'ROI1_On', 'ROI1_Off', 'ROI2_On','ROI2_Off','ROI4_Diff', 'ROI1_Diff','ROI2_Diff'] , [0.0], [30.0], [30]) +scan.start() + +#Creating channels: dimension 1 +#PseudoPositioner Pseudo +#ScalarDetector SAI01-MEAN +SAI01 = Channel('X10DA-ES1-SAI_01:MEAN', type = 'd') +#ScalarDetector SAI02 +SAI02 = Channel('X10DA-ES1-SAI_02:MEAN', type = 'd') +#ScalarDetector Ring-current +RingCurrent = Channel('ARIDI-PCT:CURRENT', type = 'd') +#ScalarDetector PilExpTime +PilExpTime = Channel('X10DA-PILATUS-1:cam1:AcquireTime_RBV', type = 'd') +#Timestamp Timestamp +#ScalarDetector PilFileNum +PilFileNum = Channel('X10DA-PILATUS-1:cam1:FileNumber_RBV', type = 'd') +#ScalarDetector TotalCounts +TotalCounts = Channel('X10DA-PILATUS-1:Stats1:Total_RBV', type = 'd') +#ScalarDetector TiffFileNumber +TiffFileNumber = Channel('X10DA-PILATUS-1:Magick1:FileNumber_RBV', type = 'd') +#ScalarDetector ROI4 +ROI4 = Channel('X10DA-PILATUS-1:Stats4:Total_RBV', type = 'd') +#ArrayDetector ROI1 +ROI1 = Channel('X10DA-PILATUS-1:Stats1:ProfileCursorX_RBV', type = '[d', size = ROI1size) +#ArrayDetector ROI2 +ROI2 = Channel('X10DA-PILATUS-1:Stats2:ProfileCursorX_RBV', type = '[d', size = ROI2size) + +#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() diff --git a/script/daq/PumpProbeXES_W1_v2.py b/script/daq/PumpProbeXES_W1_v2.py new file mode 100644 index 0000000..23cc4ce --- /dev/null +++ b/script/daq/PumpProbeXES_W1_v2.py @@ -0,0 +1,104 @@ +#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 + + +DELAY = ChannelInteger('X10DA-ES2-TIM:SET1-DELAY','X10DA-ES2-TIM:SET1-DELAY') +DELAY.initialize() + +#Creating channels: dimension 1 +#PseudoPositioner Pseudo +#ScalarDetector SAI01-MEAN +SAI01 = ChannelDouble('X10DA-ES1-SAI_01:MEAN', 'X10DA-ES1-SAI_01:MEAN') +#ScalarDetector SAI02 +SAI02 = ChannelDouble('X10DA-ES1-SAI_02:MEAN', 'X10DA-ES1-SAI_02:MEAN') +#ScalarDetector Ring-current +RingCurrent = ChannelDouble('ARIDI-PCT:CURRENT', 'ARIDI-PCT:CURRENT') +#ScalarDetector PilExpTime +PilExpTime = ChannelDouble('X10DA-PILATUS-1:cam1:AcquireTime_RBV', 'X10DA-PILATUS-1:cam1:AcquireTime_RBV') +#Timestamp Timestamp +#ScalarDetector PilFileNum +PilFileNum = ChannelDouble('X10DA-PILATUS-1:cam1:FileNumber_RBV', 'X10DA-PILATUS-1:cam1:FileNumber_RBV') +#ScalarDetector TotalCounts +TotalCounts = ChannelDouble('X10DA-PILATUS-1:Stats1:Total_RBV', 'X10DA-PILATUS-1:Stats1:Total_RBV') +#ScalarDetector TiffFileNumber +TiffFileNumber = ChannelDouble('X10DA-PILATUS-1:Magick1:FileNumber_RBV', 'X10DA-PILATUS-1:Magick1:FileNumber_RBV') +#ScalarDetector ROI4 +ROI4 = ChannelDouble('X10DA-PILATUS-1:Stats4:Total_RBV', 'X10DA-PILATUS-1:Stats4:Total_RBV') +#ArrayDetector ROI1 +ROI1_On = ChannelDoubleArray('Roi1', 'X10DA-PILATUS-1:Stats1:ProfileCursorX_RBV', ROI1size) +#ArrayDetector ROI2 +ROI2_On = ChannelDoubleArray('Roi2', 'X10DA-PILATUS-1:Stats2:ProfileCursorX_RBV' , ROI2size) + + +detectors = [SAI01, SAI02, RingCurrent, PilExpTime, PilFileNum, TotalCounts, TiffFileNumber, TiffFileNumber, ROI4, ROI1_On, ROI2_On] +for det in detectors: + det.initialize() + +#Pseudo-devices +class Roi1Off(Readable, ReadableArray): + def read(self): + before_sample() + DELAY.write(100) + time.sleep(0.1) + self.cache = caget(ROI1_On.channelName, '[d') + return self.cache + + def getSize(self): + return ROI1.getSize() + +class Roi2Off(Readable, ReadableArray): + def read(self): + self.cache = caget(ROI2_On.channelName, '[d') + DELAY.write(0) + return self.cache + + def getSize(self): + return ROI2.getSize() + +ROI1_Off=Roi1Off() +ROI2_Off=Roi2Off() + +class RoiDiff(Readable, ReadableArray): + def __init__(self, roi_on, roi_off): + self.roi_on = roi_on + self.roi_off = roi_off + + def read(self): + return arrsub(self.roi_on.take(), self.roi_off.cache) + + def getSize(self): + return self.roi_on.getSize() + +ROI1_Diff=RoiDiff(ROI1_On, ROI1_Off) +set_device_alias(ROI1_Diff, "Roi1Diff") +ROI2_Diff=RoiDiff(ROI2_On, ROI2_Off) +set_device_alias(ROI2_Diff, "Roi2Diff") + + +def before_sample(): + DELAY.write(0) + 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 + [ROI1_Off, ROI2_Off, ROI1_Diff, ROI2_Diff], 30, 0, before_read = before_sample, \ + line_plots = [ROI1_Diff, ROI2_Diff], enabled_plots = [ROI1_Diff, ROI2_Diff])finally: + for det in detectors: + det.close() + diff --git a/script/daq/XES_W1.py b/script/daq/XES_W1.py new file mode 100644 index 0000000..d24f00e --- /dev/null +++ b/script/daq/XES_W1.py @@ -0,0 +1,88 @@ +#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') + +#TODO: Set the diplay names of positioners and detectors +scan = ManualScan(['Pseudo'], ['SAI01-MEAN', 'SAI02', 'Ring-current', 'PilExpTime', 'Timestamp', 'PilFileNum', 'TotalCounts', 'TiffFileNumber', 'ROI4', 'ROI1[487]', 'ROI2[487]'] , [0.0], [30.0], [30]) +scan.start() + +#Creating channels: dimension 1 +#PseudoPositioner Pseudo +#ScalarDetector SAI01-MEAN +SAI01 = Channel('X10DA-ES1-SAI_01:MEAN', type = 'd') +#ScalarDetector SAI02 +SAI02 = Channel('X10DA-ES1-SAI_02:MEAN', type = 'd') +#ScalarDetector Ring-current +RingCurrent = Channel('ARIDI-PCT:CURRENT', type = 'd') +#ScalarDetector PilExpTime +PilExpTime = Channel('X10DA-PILATUS-1:cam1:AcquireTime_RBV', type = 'd') +#Timestamp Timestamp +#ScalarDetector PilFileNum +PilFileNum = Channel('X10DA-PILATUS-1:cam1:FileNumber_RBV', type = 'd') +#ScalarDetector TotalCounts +TotalCounts = Channel('X10DA-PILATUS-1:Stats1:Total_RBV', type = 'd') +#ScalarDetector TiffFileNumber +TiffFileNumber = Channel('X10DA-PILATUS-1:Magick1:FileNumber_RBV', type = 'd') +#ScalarDetector ROI4 +ROI4 = Channel('X10DA-PILATUS-1:Stats4:Total_RBV', type = 'd') +#ArrayDetector ROI1 +ROI1 = Channel('X10DA-PILATUS-1:Stats1:ProfileCursorX_RBV', type = '[d', size = 487) +#ArrayDetector ROI2 +ROI2 = Channel('X10DA-PILATUS-1:Stats2:ProfileCursorX_RBV', type = '[d', size = 487) + +#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) + detector1 = SAI01.get() + #Detector SAI02 + detector2 = SAI02.get() + #Detector Ring-current + detector3 = RingCurrent.get() + #Detector PilExpTime + detector4 = PilExpTime.get() + #Detector Timestamp + detector5 = float(java.lang.System.currentTimeMillis()) + #Detector PilFileNum + detector6 = PilFileNum.get() + #Detector TotalCounts + detector7 = TotalCounts.get() + #Detector TiffFileNumber + detector8 = TiffFileNumber.get() + #Detector ROI4 + detector9 = ROI4.get() + #Detector ROI1 + detector10 = ROI1.get() + #Detector ROI2 + detector11 = ROI2.get() + scan.append ([setpoint1], [readback1], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, detector9, detector10, detector11]) + +#Closing channels +SAI01.close() +SAI02.close() +RingCurrent.close() +PilExpTime.close() +PilFileNum.close() +TotalCounts.close() +TiffFileNumber.close() +ROI4.close() +ROI1.close() +ROI2.close() + +scan.end() diff --git a/script/daq/XES_W1_v2.py b/script/daq/XES_W1_v2.py new file mode 100644 index 0000000..f975eb6 --- /dev/null +++ b/script/daq/XES_W1_v2.py @@ -0,0 +1,88 @@ +#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', '300') +caput('X10DA-PILATUS-1:cam1:AcquirePeriod', '300.1') +caput('X10DA-ES1-MA1:TRX.VAL', '-18') +caput('X10DA-ES1-MA1:TRX1.VAL', '-15') + +#TODO: Set the diplay names of positioners and detectors +scan = ManualScan(['Pseudo'], ['SAI01-MEAN', 'SAI02', 'Ring-current', 'PilExpTime', 'Timestamp', 'PilFileNum', 'TotalCounts', 'TiffFileNumber', 'ROI4', 'ROI1[487]', 'ROI2[487]'] , [0.0], [30.0], [30]) +scan.start() + +#Creating channels: dimension 1 +#PseudoPositioner Pseudo +#ScalarDetector SAI01-MEAN +SAI01-MEAN = Channel('X10DA-ES1-SAI_01:MEAN', type = 'd') +#ScalarDetector SAI02 +SAI02 = Channel('X10DA-ES1-SAI_02:MEAN', type = 'd') +#ScalarDetector Ring-current +Ring-current = Channel('ARIDI-PCT:CURRENT', type = 'd') +#ScalarDetector PilExpTime +PilExpTime = Channel('X10DA-PILATUS-1:cam1:AcquireTime_RBV', type = 'd') +#Timestamp Timestamp +#ScalarDetector PilFileNum +PilFileNum = Channel('X10DA-PILATUS-1:cam1:FileNumber_RBV', type = 'd') +#ScalarDetector TotalCounts +TotalCounts = Channel('X10DA-PILATUS-1:Stats1:Total_RBV', type = 'd') +#ScalarDetector TiffFileNumber +TiffFileNumber = Channel('X10DA-PILATUS-1:Magick1:FileNumber_RBV', type = 'd') +#ScalarDetector ROI4 +ROI4 = Channel('X10DA-PILATUS-1:Stats4:Total_RBV', type = 'd') +#ArrayDetector ROI1 +ROI1 = Channel('X10DA-PILATUS-1:Stats1:ProfileCursorX_RBV', type = '[d', size = 487) +#ArrayDetector ROI2 +ROI2 = Channel('X10DA-PILATUS-1:Stats2:ProfileCursorX_RBV', type = '[d', size = 487) + +#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) + detector1 = SAI01-MEAN.get() + #Detector SAI02 + detector2 = SAI02.get() + #Detector Ring-current + detector3 = Ring-current.get() + #Detector PilExpTime + detector4 = PilExpTime.get() + #Detector Timestamp + detector5 = float(java.lang.System.currentTimeMillis()) + #Detector PilFileNum + detector6 = PilFileNum.get() + #Detector TotalCounts + detector7 = TotalCounts.get() + #Detector TiffFileNumber + detector8 = TiffFileNumber.get() + #Detector ROI4 + detector9 = ROI4.get() + #Detector ROI1 + detector10 = ROI1.get() + #Detector ROI2 + detector11 = ROI2.get() + scan.append ([setpoint1], [readback1], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, detector9, detector10, detector11]) + +#Closing channels +SAI01-MEAN.close() +SAI02.close() +Ring-current.close() +PilExpTime.close() +PilFileNum.close() +TotalCounts.close() +TiffFileNumber.close() +ROI4.close() +ROI1.close() +ROI2.close() + +scan.end() diff --git a/script/daq/XES_W2.py b/script/daq/XES_W2.py new file mode 100644 index 0000000..dca1e45 --- /dev/null +++ b/script/daq/XES_W2.py @@ -0,0 +1,88 @@ +#Script imported from: XES_W2.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', '300') +caput('X10DA-PILATUS-1:cam1:AcquirePeriod', '300.1') +caput('X10DA-ES1-MA1:TRX.VAL', '-18') +caput('X10DA-ES1-MA1:TRX1.VAL', '-15') + +#TODO: Set the diplay names of positioners and detectors +scan = ManualScan(['Pseudo'], ['SAI01-MEAN', 'SAI02', 'Ring-current', 'PilExpTime', 'Timestamp', 'PilFileNum', 'TotalCounts', 'TiffFileNumber', 'ROI4', 'ROI1[487]', 'ROI2[487]'] , [0.0], [30.0], [30]) +scan.start() + +#Creating channels: dimension 1 +#PseudoPositioner Pseudo +#ScalarDetector SAI01-MEAN +SAI01-MEAN = Channel('X10DA-ES1-SAI_01:MEAN', type = 'd') +#ScalarDetector SAI02 +SAI02 = Channel('X10DA-ES1-SAI_02:MEAN', type = 'd') +#ScalarDetector Ring-current +Ring-current = Channel('ARIDI-PCT:CURRENT', type = 'd') +#ScalarDetector PilExpTime +PilExpTime = Channel('X10DA-PILATUS-1:cam1:AcquireTime_RBV', type = 'd') +#Timestamp Timestamp +#ScalarDetector PilFileNum +PilFileNum = Channel('X10DA-PILATUS-1:cam1:FileNumber_RBV', type = 'd') +#ScalarDetector TotalCounts +TotalCounts = Channel('X10DA-PILATUS-1:Stats1:Total_RBV', type = 'd') +#ScalarDetector TiffFileNumber +TiffFileNumber = Channel('X10DA-PILATUS-1:Magick1:FileNumber_RBV', type = 'd') +#ScalarDetector ROI4 +ROI4 = Channel('X10DA-PILATUS-1:Stats4:Total_RBV', type = 'd') +#ArrayDetector ROI1 +ROI1 = Channel('X10DA-PILATUS-1:Stats1:ProfileCursorX_RBV', type = '[d', size = 487) +#ArrayDetector ROI2 +ROI2 = Channel('X10DA-PILATUS-1:Stats2:ProfileCursorX_RBV', type = '[d', size = 487) + +#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) + detector1 = SAI01-MEAN.get() + #Detector SAI02 + detector2 = SAI02.get() + #Detector Ring-current + detector3 = Ring-current.get() + #Detector PilExpTime + detector4 = PilExpTime.get() + #Detector Timestamp + detector5 = float(java.lang.System.currentTimeMillis()) + #Detector PilFileNum + detector6 = PilFileNum.get() + #Detector TotalCounts + detector7 = TotalCounts.get() + #Detector TiffFileNumber + detector8 = TiffFileNumber.get() + #Detector ROI4 + detector9 = ROI4.get() + #Detector ROI1 + detector10 = ROI1.get() + #Detector ROI2 + detector11 = ROI2.get() + scan.append ([setpoint1], [readback1], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, detector9, detector10, detector11]) + +#Closing channels +SAI01-MEAN.close() +SAI02.close() +Ring-current.close() +PilExpTime.close() +PilFileNum.close() +TotalCounts.close() +TiffFileNumber.close() +ROI4.close() +ROI1.close() +ROI2.close() + +scan.end()