Startup
This commit is contained in:
+1
-1
@@ -188,7 +188,7 @@ def convert_file(input_file_name, output_file_name, pol = None):
|
||||
###################################################################################################
|
||||
#OTF function
|
||||
###################################################################################################
|
||||
def otf(start, end, time, =0.0, mode = None, offset = None, alpha = None, name = None):
|
||||
def otf(start, end, time, delay = 0.0, mode = None, offset = None, alpha = None, name = None):
|
||||
"""
|
||||
"""
|
||||
if name is None:
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
otf(start=800, end=810, time=2.5, delay=5.0, mode='LINEAR', alpha = 0.0, offset=0.0, name='pshell-test')
|
||||
@@ -0,0 +1 @@
|
||||
field.read()
|
||||
@@ -1,140 +0,0 @@
|
||||
"""
|
||||
Example Parameters
|
||||
|
||||
ROUNDS = 1
|
||||
E1 = 634
|
||||
E2 = 665
|
||||
TIME = 2
|
||||
DELAY = 3
|
||||
|
||||
PLOT_TYPE = 1
|
||||
OFFSET1 = -2.0 #eV
|
||||
OFFSET2 = -2.9 #eV
|
||||
RUNTYPE = "+/-"
|
||||
"""
|
||||
print "\nStarting energy scan - Parameters: ",
|
||||
print E1,E2,TIME,ROUNDS,RUNTYPE
|
||||
|
||||
|
||||
run("utils")
|
||||
|
||||
polswitch = 1
|
||||
|
||||
##################### Setting filenames #######################################
|
||||
|
||||
file_prefix = time.strftime("%Y%m%d")
|
||||
fid = get_next_fid(input_path, "o" + file_prefix)
|
||||
sep = "\t"
|
||||
line_sep = "\r\n"
|
||||
|
||||
# CHANGE THE PATH IN THE OTF
|
||||
input_path = PATH
|
||||
output_path = input_path
|
||||
|
||||
###############################################################################
|
||||
#Prepare scan
|
||||
###############################################################################
|
||||
|
||||
caput ("X11PHS-E:OPT","PGM+ID1+ID2")
|
||||
|
||||
if RUNTYPE in ["+/-", "+", "-"]:
|
||||
caput(ID1_MODE,1) # circ + in ID1
|
||||
caput(ID2_MODE,2) # circ - in ID2
|
||||
wait_channel(ALL_DONE, 1, type = 'i')
|
||||
if RUNTYPE == "+/-":
|
||||
number_of_scans = 2 * ROUNDS
|
||||
else:
|
||||
number_of_scans = ROUNDS
|
||||
elif RUNTYPE in ["LH/LV", "LH", "LV"]:
|
||||
caput(ID1_MODE,0)
|
||||
caput(ID2_MODE,0)
|
||||
wait_channel(ALL_DONE, 1, type = 'i')
|
||||
caput(ID1_ALPHA, 0.0) # LH in ID1
|
||||
caput(ID2_ALPHA, 90.0) # LV in ID2
|
||||
wait_channel(ALL_DONE, 1, type = 'i')
|
||||
if RUNTYPE == "LH/LV":
|
||||
number_of_scans = 2 * ROUNDS
|
||||
else:
|
||||
number_of_scans = ROUNDS
|
||||
else:
|
||||
raise Exception("Invalid run type: " + RUNTYPE)
|
||||
|
||||
if RUNTYPE in ["-", "LV"]:
|
||||
switchpol(2, RUNTYPE) # tune ID2 --> polarization: C- or LV
|
||||
polswitch = 0
|
||||
elif RUNTYPE in ["+/-", "+", "LH/LV", "LH"]:
|
||||
switchpol(1, RUNTYPE) # tune ID1 --> polarization: C+ or LH
|
||||
time.sleep(1.0)
|
||||
|
||||
wait_channel(ALL_DONE, 1, type = 'i')
|
||||
|
||||
open_vg10()
|
||||
time.sleep(0.5)
|
||||
open_vg11()
|
||||
time.sleep(0.5)
|
||||
open_vg12()
|
||||
time.sleep(0.5)
|
||||
open_vg13()
|
||||
|
||||
###############################################################################
|
||||
#Main scan loop
|
||||
###############################################################################
|
||||
|
||||
for scan_no in range(number_of_scans):
|
||||
|
||||
suffix = ("%03d" % fid)
|
||||
input_file = input_path + "o" + file_prefix + "_" + suffix + ".dat"
|
||||
|
||||
caput(OTF_E1, E1)
|
||||
caput(OTF_E2, E2)
|
||||
caput(OTF_TIME, TIME)
|
||||
caput(OTF_FTS,file_prefix)
|
||||
caput(OTF_FID,fid)
|
||||
|
||||
caput(ENERGY_SP, E1)
|
||||
wait_channel(ALL_DONE, 1, type = 'i')
|
||||
time.sleep(DELAY)
|
||||
startPlot(PLOT_TYPE)
|
||||
|
||||
otf_start.write(1)
|
||||
time.sleep(1.0)
|
||||
print "Running scan " + str(scan_no+1) + " out of " + str(number_of_scans)
|
||||
try:
|
||||
otf_start.waitValue(0, (15 + int(TIME*60)) *1000)
|
||||
except:
|
||||
print "******** OTF STOP TIMEOUT **********"
|
||||
otf_start.write(0)
|
||||
finally:
|
||||
stopPlot()
|
||||
|
||||
time.sleep(1.0)
|
||||
|
||||
#Convert file
|
||||
output_file = output_path + "os" + file_prefix + "_" + suffix + ".dat"
|
||||
print("Converting data file: " + output_file);
|
||||
convert_file(input_file, output_file)
|
||||
plot_file(output_file, file_prefix+"_" + suffix) #"comment to supress plot
|
||||
print "Finished scan " + str(scan_no+1) + " out of " + str(number_of_scans) + " with polarisation: " + get_pol_str()
|
||||
|
||||
|
||||
if RUNTYPE in ["+/-", "LH/LV"]:
|
||||
if polswitch == 1:
|
||||
switchpol(2, RUNTYPE) # tune ID2 --> polarization: C- or LV
|
||||
polswitch = 0
|
||||
else:
|
||||
polswitch = 1
|
||||
switchpol(1, RUNTYPE) # tune ID1 --> polarization: C+ or LH
|
||||
else:
|
||||
print "running in one polarization mode, no switching"
|
||||
|
||||
time.sleep(3.0)
|
||||
fid = fid + 1
|
||||
|
||||
###############################################################################
|
||||
#Finishing scan
|
||||
###############################################################################
|
||||
|
||||
caput(ENERGY_SP, E1)
|
||||
close_vg13()
|
||||
|
||||
print "Successfully Finished Energy scan"
|
||||
Reference in New Issue
Block a user