Files
x03da/script/users/X-Treme users/launchOTF.py
2018-09-19 15:23:58 +02:00

67 lines
1.4 KiB
Python

"""
Estart = 1290.0
Estop = 1340.0
OTFtime = 10.0
"""
Estart = 1290.0
Estop = 1340.0
OTFtime = 10.0
Eph.write(Estart)
while True:
erbk = round(MonoEnergy.read(),1)
if abs(erbk - Estart) < 0.3:
break
time.sleep(0.5)
time.sleep(3.0)
print "done setting energy."
################## THIS IS TO OPEN THE VALVES
if caget('X03DA-OP-VG7:OPEN') == 'Not_Open':
caput('X03DA-OP-VG7:WT_SET',0) #open ES vacuum valve
time.sleep(0.2)
caput('X03DA-OP-VG7:WT_SET',1) #open ES vacuum valve
caput('X03DA-OP-ST1:WT_SET_CLOSE',0) #
caput('X03DA-OP-ST1:WT_SET_OPEN',1) # open ES Shutter
print "check that shutter is open..."
while True:
if caget('X03DA-OP-ST1:OPEN') == 'Open':
break
time.sleep(0.5)
print "OK."
time.sleep(3.0)
#############################################
caput('X03DA-OTF:E1', Estart)
caput('X03DA-OTF:E2', Estop)
caput('X03DA-OTF:TIME',OTFtime)
print "launch OTF scan."
caput('X03DA-OTF:RUN','START')
while True:
ret=caget('X03DA-OTF:RUN')
if ret == 'STOP':
break
fname = caget('X03DA-OTF:MSG')
print "saved data to: ",fname
time.sleep(1.0)
################### THIS IS TO CLOSE THE VALVES
caput('X03DA-OP-ST1:WT_SET_CLOSE',1) # close ES Shutter
if caget('X03DA-OP-VG7:OPEN') == 'Open':
caput('X03DA-OP-VG7:WT_SET',0) #close ES vacuum valve
time.sleep(0.2)
caput('X03DA-OP-VG7:WT_SET',1) #close ES vacuum valve
############################################