From c1bac524239e814de0b80ffae149f0c4bffa610a Mon Sep 17 00:00:00 2001 From: gac-x11ma Date: Thu, 1 Mar 2018 15:54:10 +0100 Subject: [PATCH] Startup --- script/Krieger/EnergyScanID2only.py | 181 ---------------------------- script/Krieger/xmcdID2_Bi.py | 55 --------- script/Krieger/xmcdID2_Eu.py | 46 ------- script/Krieger/xmcdID2_Se.py | 48 -------- 4 files changed, 330 deletions(-) delete mode 100644 script/Krieger/EnergyScanID2only.py delete mode 100644 script/Krieger/xmcdID2_Bi.py delete mode 100644 script/Krieger/xmcdID2_Eu.py delete mode 100644 script/Krieger/xmcdID2_Se.py diff --git a/script/Krieger/EnergyScanID2only.py b/script/Krieger/EnergyScanID2only.py deleted file mode 100644 index 3b43468..0000000 --- a/script/Krieger/EnergyScanID2only.py +++ /dev/null @@ -1,181 +0,0 @@ -import os -import traceback -import thread - -############################################################################### -# Plotting -############################################################################### - -task = None -running = False - - -def _startPlot(type): - global running - print "Starting plot: type " + str(type) - running = True - p = plot(None,name="Energy")[0] - s = p.getSeries(0) - cur = 0 - time.sleep(3.0) - while running: - try: - if otf_start.read() == 0: - break - e = energy.read() - if (abs(e-cur)) > 0.1: - v = abs((keithley_2a.read() / ((keithley_1a if (type==1) else keithley_3a).read() ))) - s.appendData(e,v) - cur = e - time.sleep(0.2) - except: - pass - print "Done Plotting" - -def startPlot(type = 1): - global task - task = fork((_startPlot,(type,)),) - -def stopPlot(): - global task, running - running = False - ret = join(task) - -############################################################################### -# Parameters -############################################################################### - -''' -E1 = 1120 -E2 = 1145 -TIME = 2.0 #min -DELAY = 1.0 #s -#PREFIX = 'Data' -#RUNTYPE = "+/-" -RUNTYPE = "+" -ROUNDS = 1 -OFFSETp = -10 -OFFSETm = -11 -PLOT_TYPE = 1 - -''' -print "\nStarting energy scan - Parameters: ", -print E1,E2,TIME,DELAY,RUNTYPE - -file_prefix = time.strftime("%y%m%d") -#input_path = "/sls/X11MA/data/X11MA/fechner_beamtime/"+file_prefix+"/" -input_path = "/sls/X11MA/data/X11MA/Krieger/"#+file_prefix+"/" -output_path = input_path #+file_prefix+"/" #"/sls/X/pshell/home/data/2017_12/juraj11MA/Data1/public/e10989/"+file_prefix+"/" -pol_str = None -mag_str = None -fid = get_next_fid(input_path, "o" + file_prefix) -number_of_scans = 1 - -############################################################################### -#Prepare scan for PGM+ID2 -############################################################################### - -caput ("X11PHS-E:OPT","PGM+ID2") -#caput(OTF_OFF1,-40) #detune ID2 -#wait_channel(OTF_DONE, 1, type = 'i')/sls/X11MA/datmokuser/ - -if RUNTYPE in ["+/-", "+", "-"]: - if RUNTYPE == "+": - caput(OTF_MODE2,1) # circ+ in ID2 - caput(OTF_OFF2,OFFSETp) - number_of_scans = ROUNDS - elif RUNTYPE == "-": - caput(OTF_MODE2,2) # circ- in ID2 - caput(OTF_OFF2,OFFSETm) - number_of_scans = ROUNDS - elif RUNTYPE == "+/-": - caput(OTF_MODE2,1) # circ+ in ID2 - caput(OTF_OFF2,OFFSETp) - number_of_scans = 2 * ROUNDS - wait_channel(OTF_DONE, 1, type = 'i') - -elif RUNTYPE in ["LH/LV", "LH", "LV"]: - print "Wrong polarization selected!" - - -else: - raise Exception("Invalid run type: " + RUNTYPE) - -#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) - time.sleep(2.0) - caput(OTF_ESET, E1) - wait_channel(OTF_DONE, 1, type = 'i') - time.sleep(DELAY) - time.sleep(2.0) - - startPlot(PLOT_TYPE) - otf_start.write(1) #Start the OTF scan - time.sleep(3.0) - print "Running scan " + str(scan_no+1) + " out of " + str(number_of_scans) - try: - #wait_channel(OTF_START, 'STOP', timeout = int(TIME*60), type = 's') - otf_start.waitValue(0, (15 + int(TIME*60)) *1000) - except: - print "******** OTF STOP TIMEOUT **********" - otf_start.write(0) - finally: - stopPlot() - - time.sleep(5.0) - #TODO: wait for file instead of sleep - #Convert file - output_file = output_path + "os" + file_prefix + "_" + suffix + ".dat" - - - - if RUNTYPE in ["+/-"]: - pol_str = caget(OTF_MODE2) - if pol_str == "CIRC +": - caput(OTF_MODE2,2) # circ- in ID2 - caput(OTF_OFF2,OFFSETm) - elif pol_str == "CIRC -": - caput(OTF_MODE2,1) # circ+ in ID2 - caput(OTF_OFF2,OFFSETp) - else: print "Check pol. change" - wait_channel(OTF_DONE, 1, type = 'i') - else: - print "running in one polarization mode, no switching" - pol_str = caget(OTF_MODE2) - - print("Converting data file: " + output_file); - mag_str = caget(MAG) - #convert_file(input_file, output_file, mag_str, pol_str) - convert_file(input_file, output_file, mag_str, pol_str) # tey and tfy saved - not normalized - plot_file(output_file, file_prefix+"_" + suffix) #"Scan " + str(scan_no+1)) - print "Finished scan " + str(scan_no+1) + " out of " + str(number_of_scans) - - time.sleep(3.0) - fid = fid + 1 - -caput(OTF_ESET, E1) -#close_vg13() - -print "Finished Energy scan" - -print("Success") - diff --git a/script/Krieger/xmcdID2_Bi.py b/script/Krieger/xmcdID2_Bi.py deleted file mode 100644 index 2543c40..0000000 --- a/script/Krieger/xmcdID2_Bi.py +++ /dev/null @@ -1,55 +0,0 @@ -caput("X11MA-ES1-10ADC:AVG",1) # acquisition time otf to 1 - - -E1 = 625 -E2 = 875 -TIME = 10 #min -DELAY = 0.10 #s -#PREFIX = 'Data' -OFFSETp = -8 -OFFSETm = -9 -PLOT_TYPE = 1 -FIELD_CHANGE_SLEEP = 10 - -#for B in [-10, 10]: -# if B > 0: -# caput("X11MA-XMCD:I-SETraw",10) #SET FIELD TO 10 AMPS -# time.sleep( FIELD_CHANGE_SLEEP ) # Settling time -# if B < 0: -# caput("X11MA-XMCD:I-SETraw",-10) # SET FIELD TO -10 AMPS -# time.sleep( FIELD_CHANGE_SLEEP ) # Settling time -# caput("X11MA-XMCD:I-SETraw",B) # SET FIELD TO b -# time.sleep( FIELD_CHANGE_SLEEP ) # Settling time - -ROUNDS = 1 - -caput("X11MA-XMCD:I-SETraw",10) #SET FIELD TO 10 AMPS -RUNTYPE = "+" -run("Krieger/EnergyScanID2only") - -RUNTYPE = "-" -run("Krieger/EnergyScanID2only") - - - -caput("X11MA-XMCD:I-SETraw",-10) #SET FIELD TO 10 AMPS -RUNTYPE = "-" -run("Krieger/EnergyScanID2only") - -RUNTYPE = "+" -run("Krieger/EnergyScanID2only") - -RUNTYPE = "+" -run("Krieger/EnergyScanID2only") - -RUNTYPE = "-" -run("Krieger/EnergyScanID2only") - - - -caput("X11MA-XMCD:I-SETraw",+10) #SET FIELD TO 10 AMPS -RUNTYPE = "-" -run("Krieger/EnergyScanID2only") - -RUNTYPE = "+" -run("Krieger/EnergyScanID2only") \ No newline at end of file diff --git a/script/Krieger/xmcdID2_Eu.py b/script/Krieger/xmcdID2_Eu.py deleted file mode 100644 index 933d10d..0000000 --- a/script/Krieger/xmcdID2_Eu.py +++ /dev/null @@ -1,46 +0,0 @@ -caput("X11MA-ES1-10ADC:AVG",1) # acquisition time otf to 1 - - -E1 = 1120 -E2 = 1145 -TIME = 5 #min -DELAY = 1.0 #s -#PREFIX = 'Data' -OFFSETp = -9.5 -OFFSETm = -10.5 -PLOT_TYPE = 1 -FIELD_CHANGE_SLEEP = 10 - -for B in [-10, 10]: - if B > 0: - caput("X11MA-XMCD:I-SETraw",10) #SET FIELD TO 10 AMPS - time.sleep( FIELD_CHANGE_SLEEP ) # Settling time - if B < 0: - caput("X11MA-XMCD:I-SETraw",-10) # SET FIELD TO -10 AMPS - time.sleep( FIELD_CHANGE_SLEEP ) # Settling time - caput("X11MA-XMCD:I-SETraw",B) # SET FIELD TO b - time.sleep( FIELD_CHANGE_SLEEP ) # Settling time - - RUNTYPE = "+" - ROUNDS = 1 - run("Krieger/EnergyScanID2only") - - RUNTYPE = "-" - ROUNDS = 1 - run("Krieger/EnergyScanID2only") - - RUNTYPE = "-" - ROUNDS = 1 - run("Krieger/EnergyScanID2only") - - RUNTYPE = "+" - ROUNDS = 1 - run("Krieger/EnergyScanID2only") - - RUNTYPE = "+" - ROUNDS = 1 - run("Krieger/EnergyScanID2only") - - RUNTYPE = "-" - ROUNDS = 1 - run("Krieger/EnergyScanID2only") diff --git a/script/Krieger/xmcdID2_Se.py b/script/Krieger/xmcdID2_Se.py deleted file mode 100644 index f11c58b..0000000 --- a/script/Krieger/xmcdID2_Se.py +++ /dev/null @@ -1,48 +0,0 @@ -caput("X11MA-ES1-10ADC:AVG",1) # acquisition time otf to 1 - - -E1 = 1410 -E2 = 1510 -TIME = 5 #min -DELAY = 2.0 #s -#PREFIX = 'Data' -OFFSETp = -11 -OFFSETm = -12 -PLOT_TYPE = 1 -FIELD_CHANGE_SLEEP = 10 - -for B in [-10, 10]: - if B > 0: - caput("X11MA-XMCD:I-SETraw",10) #SET FIELD TO 10 AMPS - time.sleep( FIELD_CHANGE_SLEEP ) # Settling time - if B < 0: - caput("X11MA-XMCD:I-SETraw",-10) # SET FIELD TO -10 AMPS - time.sleep( FIELD_CHANGE_SLEEP ) # Settling time - caput("X11MA-XMCD:I-SETraw",B) # SET FIELD TO b - time.sleep( FIELD_CHANGE_SLEEP ) # Settling time - - RUNTYPE = "+" - ROUNDS = 1 - run("Krieger/EnergyScanID2only") - - RUNTYPE = "-" - ROUNDS = 1 - run("Krieger/EnergyScanID2only") - - - RUNTYPE = "-" - ROUNDS = 1 - run("Krieger/EnergyScanID2only") - - - RUNTYPE = "+" - ROUNDS = 1 - run("Krieger/EnergyScanID2only") - - RUNTYPE = "+" - ROUNDS = 1 - run("Krieger/EnergyScanID2only") - - RUNTYPE = "-" - ROUNDS = 1 - run("Krieger/EnergyScanID2only")