From 30a4c2004fe1ac790a614a219762b8e1da3a140b Mon Sep 17 00:00:00 2001 From: gac-x11ma Date: Wed, 22 May 2019 09:03:24 +0200 Subject: [PATCH] Startup --- script/local.py | 2 +- script/some_user/e-user_test.py | 1 + script/some_user/user_test.py | 1 + script/templates/EnergyScanBasic.py | 140 ---------------------------- 4 files changed, 3 insertions(+), 141 deletions(-) create mode 100644 script/some_user/e-user_test.py create mode 100644 script/some_user/user_test.py delete mode 100644 script/templates/EnergyScanBasic.py diff --git a/script/local.py b/script/local.py index 48b4bea..694d46f 100644 --- a/script/local.py +++ b/script/local.py @@ -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: diff --git a/script/some_user/e-user_test.py b/script/some_user/e-user_test.py new file mode 100644 index 0000000..b78fe06 --- /dev/null +++ b/script/some_user/e-user_test.py @@ -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') \ No newline at end of file diff --git a/script/some_user/user_test.py b/script/some_user/user_test.py new file mode 100644 index 0000000..0f0d80c --- /dev/null +++ b/script/some_user/user_test.py @@ -0,0 +1 @@ +field.read() \ No newline at end of file diff --git a/script/templates/EnergyScanBasic.py b/script/templates/EnergyScanBasic.py deleted file mode 100644 index bf3ce16..0000000 --- a/script/templates/EnergyScanBasic.py +++ /dev/null @@ -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"