diff --git a/config/config.properties b/config/config.properties index 0d6d1ee..1b532a0 100644 --- a/config/config.properties +++ b/config/config.properties @@ -1,9 +1,9 @@ -#Mon Nov 27 16:34:20 CET 2017 +#Wed Dec 20 11:08:25 CET 2017 autoSaveScanData=true createSessionFiles=false -dataLayout=table -dataPath={data}/{year}_{month}/{date}/{date}_{time}_{name} -dataProvider=txt +dataLayout=ch.psi.fda.LayoutFDA +dataPath={data}/{year}_{month}/juraj +dataProvider=ch.psi.fda.ProviderFDA dataScanFlushRecords=true dataScanPreserveTypes=false dataScanReleaseRecords=false diff --git a/config/devices.properties b/config/devices.properties index 3b6ac32..3ad4a53 100644 --- a/config/devices.properties +++ b/config/devices.properties @@ -21,6 +21,7 @@ SamplingTime=ch.psi.pshell.epics.ChannelDouble|X11MA-ES4:SAMPLE-TIME|Read||true MCPArray2=ch.psi.pshell.epics.ChannelIntegerArray|X11MA-ES4:PHC-CTRWF2|Read||true NrCounters=ch.psi.pshell.epics.ChannelInteger|X11MA-ES4:NCTR|Read||true energy=ch.psi.pshell.epics.ChannelDouble|X11MA-PGM:rbkenergy|Read||true +energy_done=ch.psi.pshell.epics.ChannelDouble|X11MA-PHS:ALL-DONE|Read||true keithley_1a=ch.psi.pshell.epics.ChannelDouble|X11MA-ES1:CADC1|Read||true keithley_2a=ch.psi.pshell.epics.ChannelDouble|X11MA-ES1:CADC2|Read||true keithley_3a=ch.psi.pshell.epics.ChannelDouble|X11MA-ES1:CADC3|Read||true diff --git a/devices/m1.properties b/devices/m1.properties index 15c20d0..880b2ee 100644 --- a/devices/m1.properties +++ b/devices/m1.properties @@ -1,4 +1,4 @@ -#Tue Oct 27 16:28:34 CET 2015 +#Fri Dec 15 14:09:52 CET 2017 accessType=ReadWrite defaultSpeed=1.0 estbilizationDelay=0 @@ -9,5 +9,7 @@ minValue=-10.0 offset=0.0 precision=2 resolution=NaN +rotation=false scale=1.0 +startRetries=1 unit=mm diff --git a/devices/m2.properties b/devices/m2.properties index 15c20d0..880b2ee 100644 --- a/devices/m2.properties +++ b/devices/m2.properties @@ -1,4 +1,4 @@ -#Tue Oct 27 16:28:34 CET 2015 +#Fri Dec 15 14:09:52 CET 2017 accessType=ReadWrite defaultSpeed=1.0 estbilizationDelay=0 @@ -9,5 +9,7 @@ minValue=-10.0 offset=0.0 precision=2 resolution=NaN +rotation=false scale=1.0 +startRetries=1 unit=mm diff --git a/devices/p1.properties b/devices/p1.properties index bc32032..478de52 100644 --- a/devices/p1.properties +++ b/devices/p1.properties @@ -1,8 +1,9 @@ -#Wed Aug 31 13:43:05 CEST 2016 +#Fri Dec 15 14:09:53 CET 2017 maxValue=1000.0 minValue=0.0 offset=0.0 precision=-1 resolution=NaN +rotation=false scale=1.0 unit=mm diff --git a/script/EnergyScanID2only.py b/script/EnergyScanID2only.py index 686c412..cb3b27e 100644 --- a/script/EnergyScanID2only.py +++ b/script/EnergyScanID2only.py @@ -46,13 +46,13 @@ def stopPlot(): ############################################################################### -E1 = 760 -E2 = 810 -TIME = 3.0 #min -DELAY = 5.0 #s +E1 = 634 +E2 = 660 +TIME = 4.0 #min +DELAY = 1.0 #s #PREFIX = 'Data' RUNTYPE = "+/-" -ROUNDS = 3 +ROUNDS = 1 OFFSETp = -1.9 OFFSETm = -1.9 PLOT_TYPE = 1 @@ -62,8 +62,9 @@ print "\nStarting energy scan - Parameters: ", print E1,E2,TIME,DELAY,RUNTYPE file_prefix = time.strftime("%y%m%d") -input_path = "/sls/X11MA/data/X11MA/beamtime_december/"+file_prefix+"/" -output_path = input_path #+file_prefix+"/" #"/sls/X11MA/Data1/public/e10989/"+file_prefix+"/" +#input_path = "/sls/X11MA/data/X11MA/fechner_beamtime/"+file_prefix+"/" +input_path = "/sls/X11MA/data/X11MA/pshell/home/data/2017_12/juraj/" +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) @@ -75,7 +76,7 @@ number_of_scans = 1 caput ("X11PHS-E:OPT","PGM+ID2") #caput(OTF_OFF1,-40) #detune ID2 -#wait_channel(OTF_DONE, 1, type = 'i') +#wait_channel(OTF_DONE, 1, type = 'i')/sls/X11MA/datmokuser/ if RUNTYPE in ["+/-", "+", "-"]: if RUNTYPE == "+": @@ -99,12 +100,12 @@ elif RUNTYPE in ["LH/LV", "LH", "LV"]: 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_vg10() +#time.sleep(0.5) +#open_vg11() +#time.sleep(0.5) +#open_vg12() +#time.sleep(0.5) open_vg13() ############################################################################### @@ -162,7 +163,8 @@ for scan_no in range(number_of_scans): 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) + 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) @@ -170,7 +172,7 @@ for scan_no in range(number_of_scans): fid = fid + 1 caput(OTF_ESET, E1) -close_vg13() +#close_vg13() print "Finished Energy scan" diff --git a/script/EnergyScanID2only_XMLD.py b/script/EnergyScanID2only_XMLD.py new file mode 100644 index 0000000..89a978d --- /dev/null +++ b/script/EnergyScanID2only_XMLD.py @@ -0,0 +1,162 @@ +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 = 520 +E2 = 530 +TIME = 0.5 #min +DELAY = 1.0 #s +#PREFIX = 'Data' +RUNTYPE = "LV" +ROUNDS = 1 +OFFSETH = -4 +OFFSETV = -5 +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/fechner_beamtime/" +output_path = input_path #+file_prefix+"/" #"/sls/X11MA/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 ["LH", "LV"]: + if RUNTYPE == "LH": + caput(OTF_MODE2,0) + wait_channel(OTF_DONE, 1, type = 'i') + caput(OTF_ALPHA2, 0.0) # LH in ID1 + caput(OTF_OFF2,OFFSETH) + number_of_scans = ROUNDS + + elif RUNTYPE == "LV": + caput(OTF_MODE2,0) # circ- in ID2 + wait_channel(OTF_DONE, 1, type = 'i') + caput(OTF_ALPHA2, 90.0) # LH in ID1 + caput(OTF_OFF2,OFFSETV) + number_of_scans = ROUNDS + +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" + + + pol_str = caget(OTF_MODE2)+" "+str(caget(OTF_ALPHA2)) + + 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,keithley_3=1) # 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/EnergyScanID2only_juraj.py b/script/EnergyScanID2only_juraj.py new file mode 100644 index 0000000..f00ef9a --- /dev/null +++ b/script/EnergyScanID2only_juraj.py @@ -0,0 +1,185 @@ +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 = 634 +E2 = 660 +TIME = 4.0 #min +DELAY = 1.0 #s +#PREFIX = 'Data' +RUNTYPE = "+/-" +ROUNDS = 1 +OFFSETp = -1.9 +OFFSETm = -1.9 +PLOT_TYPE = 1 + +caput ("X11PHS-E:OPT","PGM+ID2") + +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/pshell/home/data/2017_12/juraj/" +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 + + +wait_channel(OTF_DONE, 1, type = 'i') + + +############################################################################### +#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/Fechner/Temperature_sweepID2.py b/script/Fechner/Temperature_sweepID2.py new file mode 100644 index 0000000..7403c75 --- /dev/null +++ b/script/Fechner/Temperature_sweepID2.py @@ -0,0 +1,105 @@ +#Parameters + +B1 = 10 # starting mag. field in Amps +B2 = -B1 # final mag. field in Amps +T1=150 # starting temperature in K +T2=200 # final temperature in K +TSTEP=10 # Temperature step size +ENERGIES = (708.5,705) #list of energies in eV + +OFFSET1 = -9 #ID1 offset +OFFSET2 = -8 #ID2 offset +FIELD_PRECISION = 0.05 # in Amps +ENERGY_CHANGE_SLEEP = 0.1 # put the Enerrgy settling time if needed +FIELD_CHANGE_SLEEP = 0.1 # put the Field settling time if needed +TEMP_CHANGE_SLEEP = 10.0 # put the Temperature settling time if needed +ACC_TIME = 150.0 # accumulation time s + +# List of scans. +STEPS =frange(T1, T2, TSTEP, True) + +#Pre-actions +# Here offsets are set + +caput ("X11PHS-E:OPT","PGM+ID2") +#caput(OTF_OFF1,-50) #detune ID1 +caput(OTF_OFF2,OFFSET2) +wait_channel(OTF_DONE, 1, type = 'i') +#cawait("X11MA-PHS:ALL-DONE",1.0) + + +wait_channel(OTF_DONE, 1, type = 'i') + + +# setting number of samples to be averaged, which depends on the accumulation time +avg = ACC_TIME * 10 +caputq("X11MA-ES1-10ADC:AVG",avg) + + +# plot properties +set_preference(Preference.ENABLED_PLOTS, ['field', 'tey_norm']) +set_preference(Preference.PLOT_TYPES, {'tey_norm':1}) + +#scan = ManualScan(['field', 'Energy'], ['TEY', 'I0', 'polarization', 'temperature', 'RingCurrent', 'tey_norm'] , [min(setpoints), min(ENERGIES)], [max(setpoints), max(ENERGIES)], [len(setpoints)-1, len(ENERGIES)-1]) +scan = ManualScan(['field', 'Energy','Temperature'], ['I0', 'TEY', 'TFY', 'polarization', 'temperature', 'RingCurrent', 'tey_norm','tfy_norm'] , [min([B1,B2]), min(ENERGIES),min(STEPS)], [max([B1,B2]), max(ENERGIES),max(STEPS)], [1, len(ENERGIES)-1, len(STEPS)-1]) +scan.start() + +# Main loop +for T in STEPS: + # set Temperature + caputq(OTF_MODE2,1) # already set the polarization + caput("X11MA-XMCD:I-SETraw",B1)# warm in B1 + caput('X11MA-ES3-LSCI:TEMP.VAL',T) + # while not caget('X11MA-ES3-LSCI:TEMP-STAT'): + #time.sleep(5) + time.sleep( TEMP_CHANGE_SLEEP ) # Settling time + #Mode loop: + for MODE in [1,2]: #polarization (CIRC+ -> 1 or CIRC- -> 2) + caput(OTF_MODE2,MODE) + #Field loop + for B in [B1,B2]: + print "Setting field = ", B + caput("X11MA-XMCD:I-SETraw",B) + time.sleep( FIELD_CHANGE_SLEEP ) # Settling time + + readback1 = caget("X11MA-XMCD:Ireadout") + + while abs(readback1-B) > FIELD_PRECISION: + readback1 = caget("X11MA-XMCD:Ireadout") + time.sleep(0.5) + + for E in ENERGIES: + print "Setting energy = ", E + caput(OTF_ESET, E) + wait_channel(OTF_DONE, 1, type = 'i') + readback2 = energy.read() + if abs(readback2 - E) > 0.1 : # TODO: Check accuracy + raise Exception('Energy could not be set to the value ' + str(E)) + sleep( ENERGY_CHANGE_SLEEP ) # Settling time + caput("X11MA-ES1-10ADC:TRG.PROC",1) # accumulate + time.sleep( 0.1) # wait a bit more + detector1 = keithley_1a.read() #Keithley1 + detector2 = keithley_2a.read() #Keithley2 + detector3 = keithley_3a.read() #Keithley3 + detector4 = caget(OTF_MODE2) #polarization in ID2 + #detector5 = caget("X11MA-ID2:ALPHA-READ") # polAngle in ID2 + detector6 = caget('X11MA-ES3-LSCI:TEMP_RBV') #temperature.get() + detector7 = caget("ARIDI-PCT:CURRENT") + #detector8 = signal_field_analog_x.read() # fieldAnalogX.get() + tey_norm = detector2/detector1 + tfy_norm = detector3/detector1 + + #converting polarization strings to integer numbers: C+ -> 1 and C- -> 2 + if detector4 == 'CIRC +': detector4 = 1 + elif detector4 == 'CIRC -': detector4 = 2 + else: detector4 = 0 + readback3=caget('X11MA-ES3-LSCI:TEMP_RBV') # read temperature + #scan.append ([B, E], [readback1, readback2], [detector1, detector2, detector4, detector6, detector7, tey_norm]) + scan.append ([B, E, T], [readback1, readback2, readback3], [detector1, detector2, detector3, detector4, detector6, detector7, tey_norm, tfy_norm]) + +scan.end() +caput("X11MA-ES1-10ADC:AVG",1) + + +print "Wake up its done" +print("Success") diff --git a/script/Fechner/field_sweepID2.py b/script/Fechner/field_sweepID2.py new file mode 100644 index 0000000..85d5bc4 --- /dev/null +++ b/script/Fechner/field_sweepID2.py @@ -0,0 +1,98 @@ +#Parameters +''' +B1 = 10 # starting mag. field in Amps +B2 = -10 # final mag. field in Amps +BSTEP = 10 # step size mag. field in Amps +ENERGIES = (1300,1310) #list of energies in eV +MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2) +OFFSET1 = -9 #ID1 offset +OFFSET2 = -9.50 #ID2 offset +FIELD_PRECISION = 0.05 # in Amps +ENERGY_CHANGE_SLEEP = 0.0 # put the Enerrgy settling time if needed +FIELD_CHANGE_SLEEP = 0.0 # put the Field settling time if needed +ACC_TIME = 1.0 # accumulation time +''' +# List of scans. Each scan is defined as: (start,stop, step) +# to make a whole loop two scans are needed: [(B1, B2, BSTEP),(B2,B1,-BSTEP)] +# to make half of a loop one scan is needed: [(B1, B2, BSTEP),] <- don't forget to put comma before ] +RANGES = [(B1, B2, -BSTEP),(B2,B1,BSTEP)] + + +#Pre-actions +# Here polarization and offsets are set + +caput ("X11PHS-E:OPT","PGM+ID2") +#caput(OTF_OFF1,-50) #detune ID1 +caput(OTF_OFF2,OFFSET2) +wait_channel(OTF_DONE, 1, type = 'i') +#cawait("X11MA-PHS:ALL-DONE",1.0) + +if MODE is 1 or 2: + caput(OTF_MODE2,MODE) +else: + raise Exception("Invalid polarization type: " + MODE) + + +wait_channel(OTF_DONE, 1, type = 'i') + + +# setting number of samples to be averaged, which depends on the accumulation time +avg = ACC_TIME * 10 +caputq("X11MA-ES1-10ADC:AVG",avg) + +# Generating a list of mag. fields (setpoints) needed for the loop +setpoints = [] +for r in RANGES: + setpoints = setpoints + frange(r[0], r[1], r[2], True) + +# plot properties +set_preference(Preference.ENABLED_PLOTS, ['field', 'tey_norm']) +set_preference(Preference.PLOT_TYPES, {'tey_norm':1}) + +#scan = ManualScan(['field', 'Energy'], ['TEY', 'I0', 'polarization', 'temperature', 'RingCurrent', 'tey_norm'] , [min(setpoints), min(ENERGIES)], [max(setpoints), max(ENERGIES)], [len(setpoints)-1, len(ENERGIES)-1]) +scan = ManualScan(['field', 'Energy'], ['I0', 'TEY', 'TFY', 'polarization', 'temperature', 'RingCurrent', 'tey_norm','tfy_norm'] , [min(setpoints), min(ENERGIES)], [max(setpoints), max(ENERGIES)], [len(setpoints)-1, len(ENERGIES)-1]) +scan.start() + +# Main loop +for B in setpoints: + print "Setting field = ", B + caput("X11MA-XMCD:I-SETraw",B) + time.sleep( FIELD_CHANGE_SLEEP ) # Settling time + + readback1 = caget("X11MA-XMCD:Ireadout") + + while abs(readback1-B) > FIELD_PRECISION: + readback1 = caget("X11MA-XMCD:Ireadout") + time.sleep(0.5) + + for E in ENERGIES: + print "Setting energy = ", E + caput(OTF_ESET, E) + wait_channel(OTF_DONE, 1, type = 'i') + readback2 = energy.read() + if abs(readback2 - E) > 0.1 : # TODO: Check accuracy + raise Exception('Energy could not be set to the value ' + str(E)) + sleep( ENERGY_CHANGE_SLEEP ) # Settling time + caput("X11MA-ES1-10ADC:TRG.PROC",1) #accumulate + time.sleep(0.1) # wait a bit more + detector1 = keithley_1a.read() #Keithley1 + detector2 = keithley_2a.read() #Keithley2 + detector3 = keithley_3a.read() #Keithley3 + detector4 = caget(OTF_MODE2) #polarization in ID2 + #detector5 = caget("X11MA-ID2:ALPHA-READ") # polAngle in ID2 + detector6 = caget('X11MA-ES3-LSCI:TEMP_RBV') #temperature.get() + detector7 = caget("ARIDI-PCT:CURRENT") + #detector8 = signal_field_analog_x.read() # fieldAnalogX.get() + tey_norm = detector2/detector1 + tfy_norm = detector3/detector1 + + #converting polarization strings to integer numbers: C+ -> 1 and C- -> 2 + if detector4 == 'CIRC +': detector4 = 1 + elif detector4 == 'CIRC -': detector4 = 2 + else: detector4 = 0 + + #scan.append ([B, E], [readback1, readback2], [detector1, detector2, detector4, detector6, detector7, tey_norm]) + scan.append ([B, E], [readback1, readback2], [detector1, detector2, detector3, detector4, detector6, detector7, tey_norm, tfy_norm]) + +scan.end() +caput("X11MA-ES1-10ADC:AVG",1) \ No newline at end of file diff --git a/script/Fechner/hyst_ID2.py b/script/Fechner/hyst_ID2.py new file mode 100644 index 0000000..8b4e708 --- /dev/null +++ b/script/Fechner/hyst_ID2.py @@ -0,0 +1,28 @@ + +B1 = 10 # starting mag. field in Amps +B2 = -B1 # final mag. field in Amps +BSTEP = 1 # step size mag. field in Amps +ENERGIES = (636.5, 640.7) #list of energies in eV + +FIELD_PRECISION = 0.05 # in Amps +ENERGY_CHANGE_SLEEP = 0.1 # put the Enerrgy settling time if needed +FIELD_CHANGE_SLEEP = 0.2 # put the Field settling time if needed +ACC_TIME = 10 # acquisition time in seconds + + +MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2) +OFFSET2 = -8 #ID2 offset +run("Fechner/field_sweepID2") + +MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2) +OFFSET2 = -9 #ID2 offset +run("Fechner/field_sweepID2") +''' +MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2) +OFFSET2 = -9 #ID2 offset +run("Fechner/field_sweepID2") + +MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2) +OFFSET2 = -8 #ID2 offset +run("Fechner/field_sweepID2") +''' diff --git a/script/Fechner/xmcdID2.py b/script/Fechner/xmcdID2.py new file mode 100644 index 0000000..b58f2ed --- /dev/null +++ b/script/Fechner/xmcdID2.py @@ -0,0 +1,31 @@ +caput("X11MA-ES1-10ADC:AVG",1) # acquisition time otf to 1 + +#B=5 +#caput("X11MA-XMCD:I-SETraw",B) + +E1 = 690 +E2 = 760 +TIME = 3 #min +DELAY = 2.0 #s +#PREFIX = 'Data' +OFFSETp = -1.9 +OFFSETm = -1.9 +PLOT_TYPE = 1 + +RUNTYPE = "+" +ROUNDS = 1 +run("EnergyScanID2only") + +''' +RUNTYPE = "-" +ROUNDS = 1 +run("EnergyScanID2only") + +RUNTYPE = "-" +ROUNDS = 1 +run("EnergyScanID2only") + +RUNTYPE = "+" +ROUNDS = 1 +run("EnergyScanID2only") +''' \ No newline at end of file diff --git a/script/Fechner/xmcdID2_Al.py b/script/Fechner/xmcdID2_Al.py new file mode 100644 index 0000000..a6cc728 --- /dev/null +++ b/script/Fechner/xmcdID2_Al.py @@ -0,0 +1,46 @@ +caput("X11MA-ES1-10ADC:AVG",1) # acquisition time otf to 1 + + +E1 = 1530 +E2 = 1600 +TIME = 6 #min +DELAY = 2.0 #s +#PREFIX = 'Data' +OFFSETp = -10 +OFFSETm = -11 +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("EnergyScanID2only") + + RUNTYPE = "-" + ROUNDS = 1 + run("EnergyScanID2only") + + RUNTYPE = "-" + ROUNDS = 1 + run("EnergyScanID2only") + + RUNTYPE = "+" + ROUNDS = 1 + run("EnergyScanID2only") + + RUNTYPE = "+" + ROUNDS = 1 + run("EnergyScanID2only") + + RUNTYPE = "-" + ROUNDS = 1 + run("EnergyScanID2only") diff --git a/script/Fechner/xmcdID2_Fe-one-run.py b/script/Fechner/xmcdID2_Fe-one-run.py new file mode 100644 index 0000000..13ad1b4 --- /dev/null +++ b/script/Fechner/xmcdID2_Fe-one-run.py @@ -0,0 +1,28 @@ +caput("X11MA-ES1-10ADC:AVG",1) # acquisition time otf to 1 + +#B=5 +#caput("X11MA-XMCD:I-SETraw",B) + +E1 = 690 +E2 = 760 +TIME = 4 #min +DELAY = 2.0 #s +#PREFIX = 'Data' +OFFSETp = -8 +OFFSETm = -9 +PLOT_TYPE = 1 +FIELD_CHANGE_SLEEP = 10 + + + + +RUNTYPE = "+" +ROUNDS = 1 +run("EnergyScanID2only") +''' +RUNTYPE = "-" +ROUNDS = 1 +run("EnergyScanID2only") + +''' +print "Success!" \ No newline at end of file diff --git a/script/Fechner/xmcdID2_Fe.py b/script/Fechner/xmcdID2_Fe.py new file mode 100644 index 0000000..20b1230 --- /dev/null +++ b/script/Fechner/xmcdID2_Fe.py @@ -0,0 +1,55 @@ +caput("X11MA-ES1-10ADC:AVG",1) # acquisition time otf to 1 + +#B=5 +#caput("X11MA-XMCD:I-SETraw",B) + +E1 = 690 +E2 = 745 +TIME = 3.5 #min +DELAY = 2.0 #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 + + + + RUNTYPE = "+" + ROUNDS = 1 + run("EnergyScanID2only") + + RUNTYPE = "-" + ROUNDS = 1 + run("EnergyScanID2only") + + RUNTYPE = "-" + ROUNDS = 1 + run("EnergyScanID2only") + + RUNTYPE = "+" + ROUNDS = 1 + run("EnergyScanID2only") + + RUNTYPE = "+" + ROUNDS = 1 + run("EnergyScanID2only") + + RUNTYPE = "-" + ROUNDS = 1 + run("EnergyScanID2only") + + +print "Success!" \ No newline at end of file diff --git a/script/Fechner/xmcdID2_Mg.py b/script/Fechner/xmcdID2_Mg.py new file mode 100644 index 0000000..10681f3 --- /dev/null +++ b/script/Fechner/xmcdID2_Mg.py @@ -0,0 +1,46 @@ +caput("X11MA-ES1-10ADC:AVG",1) # acquisition time otf to 1 + + +E1 = 1290 +E2 = 1380 +TIME = 4 #min +DELAY = 2.0 #s +#PREFIX = 'Data' +OFFSETp = -10 +OFFSETm = -11 +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("EnergyScanID2only") + + RUNTYPE = "-" + ROUNDS = 1 + run("EnergyScanID2only") + + RUNTYPE = "-" + ROUNDS = 1 + run("EnergyScanID2only") + + RUNTYPE = "+" + ROUNDS = 1 + run("EnergyScanID2only") + + RUNTYPE = "+" + ROUNDS = 1 + run("EnergyScanID2only") + + RUNTYPE = "-" + ROUNDS = 1 + run("EnergyScanID2only") diff --git a/script/Fechner/xmcdID2_OCr.py b/script/Fechner/xmcdID2_OCr.py new file mode 100644 index 0000000..bc8e680 --- /dev/null +++ b/script/Fechner/xmcdID2_OCr.py @@ -0,0 +1,49 @@ + + + +caput("X11MA-ES1-10ADC:AVG",1) # acquisition time otf to 1 +E1 = 520 +E2 = 600 +TIME = 4 #min +DELAY = 2.0 #s +#PREFIX = 'Data' +OFFSETp = -6.0 +OFFSETm = -7.0 +PLOT_TYPE = 1 +FIELD_CHANGE_SLEEP = 5 + +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("EnergyScanID2only") + + RUNTYPE = "-" + ROUNDS = 1 + run("EnergyScanID2only") + + RUNTYPE = "-" + ROUNDS = 1 + run("EnergyScanID2only") + + RUNTYPE = "+" + ROUNDS = 1 + run("EnergyScanID2only") + + RUNTYPE = "+" + ROUNDS = 1 + run("EnergyScanID2only") + + RUNTYPE = "-" + ROUNDS = 1 + run("EnergyScanID2only") + + diff --git a/script/Fechner/xmcdID2_OCr_fix_drift.py b/script/Fechner/xmcdID2_OCr_fix_drift.py new file mode 100644 index 0000000..b50ceb7 --- /dev/null +++ b/script/Fechner/xmcdID2_OCr_fix_drift.py @@ -0,0 +1,54 @@ +caput("X11MA-ES1-10ADC:AVG",1) # acquisition time otf to 1 + +#B=5 +#caput("X11MA-XMCD:I-SETraw",B) + +E1 = 520 +E2 = 600 +TIME = 4 #min +DELAY = 2.0 #s +#PREFIX = 'Data' +OFFSETp = -6.0 +OFFSETm = -7.0 +PLOT_TYPE = 1 + +RUNTYPE = "+" +ROUNDS = 1 +run("EnergyScanID2only") + +RUNTYPE = "-" +ROUNDS = 1 +run("EnergyScanID2only") + +RUNTYPE = "-" +ROUNDS = 1 +run("EnergyScanID2only") + +RUNTYPE = "+" +ROUNDS = 1 +run("EnergyScanID2only") + +RUNTYPE = "+" +ROUNDS = 1 +run("EnergyScanID2only") + +RUNTYPE = "-" +ROUNDS = 1 +run("EnergyScanID2only") + + +RUNTYPE = "-" +ROUNDS = 1 +run("EnergyScanID2only") + +RUNTYPE = "+" +ROUNDS = 1 +run("EnergyScanID2only") + +RUNTYPE = "+" +ROUNDS = 1 +run("EnergyScanID2only") + +RUNTYPE = "-" +ROUNDS = 1 +run("EnergyScanID2only") diff --git a/script/Fechner/xmldID2_Fe.py b/script/Fechner/xmldID2_Fe.py new file mode 100644 index 0000000..9a3384c --- /dev/null +++ b/script/Fechner/xmldID2_Fe.py @@ -0,0 +1,43 @@ +caput("X11MA-ES1-10ADC:AVG",1) # acquisition time otf to 1 + +#B=5 +#caput("X11MA-XMCD:I-SETraw",B) + +E1 = 690 +E2 = 760 +TIME = 4 #min +DELAY = 2.0 #s +#PREFIX = 'Data' +OFFSETp = -4 +OFFSETm = -5 +PLOT_TYPE = 1 + + +RUNTYPE = "LH" +ROUNDS = 1 +run("EnergyScanID2only_XMLD") + +RUNTYPE = "LV" +ROUNDS = 1 +run("EnergyScanID2only_XMLD") + +RUNTYPE = "LV" +ROUNDS = 1 +run("EnergyScanID2only_XMLD") + +RUNTYPE = "LH" +ROUNDS = 1 +run("EnergyScanID2only_XMLD") + +RUNTYPE = "LH" +ROUNDS = 1 +run("EnergyScanID2only_XMLD") + + +RUNTYPE = "LV" +ROUNDS = 1 +run("EnergyScanID2only_XMLD") + + + +print "Success!" diff --git a/script/Fechner/xmldID2_Mg.py b/script/Fechner/xmldID2_Mg.py new file mode 100644 index 0000000..d60dc73 --- /dev/null +++ b/script/Fechner/xmldID2_Mg.py @@ -0,0 +1,37 @@ +caput("X11MA-ES1-10ADC:AVG",1) # acquisition time otf to 1 + +#B=5 +#caput("X11MA-XMCD:I-SETraw",B) + +E1 = 1290 +E2 = 1380 +TIME = 4 #min +DELAY = 1.0 #s +#PREFIX = 'Data' +OFFSETp = -4 +OFFSETm = -5 +PLOT_TYPE = 1 + +RUNTYPE = "LH" +ROUNDS = 1 +run("EnergyScanID2only_XMLD") + +RUNTYPE = "LV" +ROUNDS = 1 +run("EnergyScanID2only_XMLD") + +RUNTYPE = "LV" +ROUNDS = 1 +run("EnergyScanID2only_XMLD") + +RUNTYPE = "LH" +ROUNDS = 1 +run("EnergyScanID2only_XMLD") + +RUNTYPE = "LH" +ROUNDS = 1 +run("EnergyScanID2only_XMLD") + +RUNTYPE = "LV" +ROUNDS = 1 +run("EnergyScanID2only_XMLD") diff --git a/script/Fechner/xmldID2_OCr_fix_drift.py b/script/Fechner/xmldID2_OCr_fix_drift.py new file mode 100644 index 0000000..1c76ee5 --- /dev/null +++ b/script/Fechner/xmldID2_OCr_fix_drift.py @@ -0,0 +1,40 @@ +caput("X11MA-ES1-10ADC:AVG",1) # acquisition time otf to 1 + +#B=5 +#caput("X11MA-XMCD:I-SETraw",B) + +E1 = 520 +E2 = 600 +TIME = 4 #min +DELAY = 2.0 #s +#PREFIX = 'Data' +OFFSETH = -4 +OFFSETV = -5 +PLOT_TYPE = 1 + +RUNTYPE = "LH" +ROUNDS = 1 +run("EnergyScanID2only_XMLD") + +RUNTYPE = "LV" +ROUNDS = 1 +run("EnergyScanID2only_XMLD") + +RUNTYPE = "LV" +ROUNDS = 1 +run("EnergyScanID2only_XMLD") + +RUNTYPE = "LH" +ROUNDS = 1 +run("EnergyScanID2only_XMLD") + +RUNTYPE = "LH" +ROUNDS = 1 +run("EnergyScanID2only_XMLD") + +RUNTYPE = "LV" +ROUNDS = 1 +run("EnergyScanID2only_XMLD") + + +print "Scan complete!!!!!!" \ No newline at end of file diff --git a/script/Krieger/EnergyScanID2only.py b/script/Krieger/EnergyScanID2only.py new file mode 100644 index 0000000..3b43468 --- /dev/null +++ b/script/Krieger/EnergyScanID2only.py @@ -0,0 +1,181 @@ +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 new file mode 100644 index 0000000..adca7c2 --- /dev/null +++ b/script/Krieger/xmcdID2_Bi.py @@ -0,0 +1,31 @@ +caput("X11MA-ES1-10ADC:AVG",1) # acquisition time otf to 1 + + +E1 = 425 +E2 = 475 +TIME = 3 #min +DELAY = 2.0 #s +#PREFIX = 'Data' +OFFSETp = -5.5 +OFFSETm = -6.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") + diff --git a/script/Krieger/xmcdID2_Eu.py b/script/Krieger/xmcdID2_Eu.py new file mode 100644 index 0000000..6461cbd --- /dev/null +++ b/script/Krieger/xmcdID2_Eu.py @@ -0,0 +1,46 @@ +caput("X11MA-ES1-10ADC:AVG",1) # acquisition time otf to 1 + + +E1 = 1120 +E2 = 1145 +TIME = 4 #min +DELAY = 2.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/harmonic_ID2.xml b/script/harmonic_ID2.xml index 5bb27cb..71b5805 100644 --- a/script/harmonic_ID2.xml +++ b/script/harmonic_ID2.xml @@ -2,14 +2,14 @@ - + - 785.0 - 795.0 + 510.0 + 530.0 1.0 diff --git a/script/xas_0H_juraj.py b/script/xas_0H_juraj.py new file mode 100644 index 0000000..a5ab1b7 --- /dev/null +++ b/script/xas_0H_juraj.py @@ -0,0 +1,80 @@ +B1 = 10 # starting mag. field in Amps +B2 = -B1 # final mag. field in Amps +BSTEP = 1 # step size mag. field in Amps +ENERGIES = (636.5, 641.2) #list of energies in eV + +FIELD_PRECISION = 0.05 # in Amps +ENERGY_CHANGE_SLEEP = 0.1 # put the Enerrgy settling time if needed +FIELD_CHANGE_SLEEP = 0.2 # put the Field settling time if needed +ACC_TIME = 10 # acquisition time in seconds + + +#MODE = 1 #polarization (CIRC+ -> 1 or CIRC- -> 2) +#OFFSET2 = -8 #ID2 offset +#run("Fechner/field_sweepID2") + +MODE = 2 #polarization (CIRC+ -> 1 or CIRC- -> 2) +OFFSET2 = -9 #ID2 offset +run("Fechner/field_sweepID2") + +caput("X11MA-XMCD:I-SETraw",0) + +run("EnergyScanID2only_juraj") + +run("EnergyScanID2only_juraj") + +run("EnergyScanID2only_juraj") + +run("EnergyScanID2only_juraj") + +run("EnergyScanID2only_juraj") + +run("EnergyScanID2only_juraj") + +run("EnergyScanID2only_juraj") + +run("EnergyScanID2only_juraj") + +run("EnergyScanID2only_juraj") + +run("EnergyScanID2only_juraj") + +run("EnergyScanID2only_juraj") + +run("EnergyScanID2only_juraj") + +run("EnergyScanID2only_juraj") + +run("EnergyScanID2only_juraj") + +run("EnergyScanID2only_juraj") + +run("EnergyScanID2only_juraj") + +run("EnergyScanID2only_juraj") + +run("EnergyScanID2only_juraj") + +run("EnergyScanID2only_juraj") + +run("EnergyScanID2only_juraj") + +run("EnergyScanID2only_juraj") + +run("EnergyScanID2only_juraj") + +run("EnergyScanID2only_juraj") + +run("EnergyScanID2only_juraj") + +run("EnergyScanID2only_juraj") + +run("EnergyScanID2only_juraj") + +run("EnergyScanID2only_juraj") + +run("EnergyScanID2only_juraj") + +run("EnergyScanID2only_juraj") + +run("EnergyScanID2only_juraj")