diff --git a/script/local.py b/script/local.py index 454fcde0..17a31f15 100644 --- a/script/local.py +++ b/script/local.py @@ -323,7 +323,8 @@ def after_scan(): """ Close shutter and turn off analyser """ - caput("X03DA-PC:AFTER-SCAN.PROC", 1) + #caput("X03DA-PC:AFTER-SCAN.PROC", 1) + caput("X03DA-FE-AB1:CLOSE4BL", 0) #release_keithleys() def set_adc_averaging(dwelltime=0.0): diff --git a/script/users/Granas/ManipulatorScan_C1s.py b/script/users/Granas/ManipulatorScan_C1s.py index 50d00189..2463dcab 100644 --- a/script/users/Granas/ManipulatorScan_C1s.py +++ b/script/users/Granas/ManipulatorScan_C1s.py @@ -33,15 +33,22 @@ if True: ENDSCAN = True ############################################################################# # this changes the number of dummy scans zou do next time - STEPS = 10 + """ + STEPS = 12 ############################################################################# MOTOR = dummy - RANGE = (0,10) + RANGE = (0,12) + """ + STEPS = 12 + ############################################################################# + MOTOR = ManipulatorZ + RANGE = (113.5,119.5) + RELATIVE = False setVal("X03DA-FE-AB1:CLOSE4BL","1") #opening the beam line - time.sleep(4) + time.sleep(0.5) execfile("/sls/X03DA/data/gac-x03da/pshell/home/script/users/Granas/ManipulatorScan_base.py") setVal("X03DA-FE-AB1:CLOSE4BL","0") #closeing the beam line - time.sleep(10) \ No newline at end of file + time.sleep(0.5) \ No newline at end of file diff --git a/script/users/Granas/ManipulatorScan_O1s.py b/script/users/Granas/ManipulatorScan_O1s.py index 08e88bcf..ae4b337d 100644 --- a/script/users/Granas/ManipulatorScan_O1s.py +++ b/script/users/Granas/ManipulatorScan_O1s.py @@ -31,14 +31,18 @@ if True: skip_iteration = False ENDSCAN = True + ############################################################################# + # this changes the number of dummy scans zou do next time STEPS = 10 - MOTOR = dummy - RANGE = (0,10) + ############################################################################# + MOTOR = ManipulatorZ + RANGE = (114,119) + RELATIVE = False setVal("X03DA-FE-AB1:CLOSE4BL","1") #opening the beam line - time.sleep(4) + time.sleep(0.5) execfile("/sls/X03DA/data/gac-x03da/pshell/home/script/users/Granas/ManipulatorScan_base.py") setVal("X03DA-FE-AB1:CLOSE4BL","0") #closeing the beam line - time.sleep(4) \ No newline at end of file + time.sleep(0.5) \ No newline at end of file diff --git a/script/users/Granas/XPSSpectrum.py b/script/users/Granas/XPSSpectrum.py deleted file mode 100644 index 4b818cea..00000000 --- a/script/users/Granas/XPSSpectrum.py +++ /dev/null @@ -1,182 +0,0 @@ -""" -author chritstoph seitz - -starting the xps measurement - -Fermi edge of C1s test -""" - - -""" -here the copy of XPSSpectrum starts - -""" - -#Parameters (global variables): -# ranges: list of RangeSelection havinf args = (step_size, step_time, iterations) -# pass_energy -# save_scienta_image -# -# skip_iteration: if set to 1 then skips after end of current iteration - -global ranges, pass_energy, skip_iteration, ENDSCAN -""" old settings -ranges = [] -# (eph, min, max, step, time, iter) -ranges.append((1300.0, 577.0, 593.0, 0.1, 0.2, 1700)) -ranges.append((1300.0, 713.0, 722.0, 0.1, 0.2, 1000)) -ranges.append((1300.0, 1294.5, 1297.0, 0.02, 1, 2)) -pass_energy = 50 -skip_iteration = False -ENDSCAN = True -""" - -cont ="" -command_path_tmp = "/sls/X03DA/data/gac-x03da/Data1/2018/10/Granas/XPSstuff/commands/set_measure.txt" -if os.path.exists(command_path_tmp): - cont = open(command_path_tmp).read() - -ranges = [] - -select_edge_tmp = cont - - -pass_energy = 20 #O1s -#save_scienta_image = True - -skip_iteration = False -ENDSCAN = True - -# (eph, min, max, step, time, iter) -if "O1s" in select_edge_tmp: - mprint("___starting O1s measure___") - loadParameterset(pearlU_path+"settings/screw_GE_pos.txt") - range1 = getParameterset(pearlU_path+"settings/FE_O1s.txt") - waitForEnergy(range1[0]) - waitForGroup("mov-") - print range1 - pass_energy = 20 #O1s - #ranges.append((650.0, 645., 647.0, 0.1, 0.2, 10)) # O1s - ranges.append(range1) #XX -elif "C1s" in select_edge_tmp: - mprint("___starting C1s measure___") - loadParameterset(pearlU_path+"settings/screw_GE_pos.txt") - range1 = getParameterset(pearlU_path+"settings/FE_C1s.txt") - waitForEnergy(range1[0]) - waitForGroup("mov-") - print range1 - pass_energy = 50 #O1s - ranges.append((390.0, 384.4, 387.0, 0.1, 0.2, 20)) # C1s - #ranges.append(range1)#XX -elif "test" in select_edge_tmp: - mprint("___starting C1s measure___") - range1 = getParameterset(pearlU_path+"settings/FE_C1s.txt") - waitForEnergy(range1[0]) - print range1 - pass_energy = 20 #O1s - ranges.append((390.0, 384.4, 387.0, 0.1, 0.2, 20)) # C1s - #ranges.append(range1)#XX -else: - print "no command fount" - -from ch.psi.pshell.data.LayoutDefault import ATTR_WRITABLE_DIMENSION as ATTR_WRITABLE_DIMENSION - -cur_range = 0 -cur_iteration = 0 - -Scienta.acquisitionMode = Scienta.AcquisitionMode.Swept -ret=[] - -set_exec_pars(open = True) - -#Global arguments -Scienta.passEnergy = pass_energy - -names=[] -names.append("Online Spectrum") -for i in range(len(ranges)): - names.append(str(ranges[i][0])) -plots = plot(None, names) -spectrum_series = plots[0].getSeries(0) -def plot_cur_spectrum(): - global spectrum_series - try: - while get_context().state.running: - y = Scienta.spectrum.take(100) - x = Scienta.spectrumX - spectrum_series.setData(x, y) - time.sleep(1.0) - finally: - print "Stopping spectrum plotting" -task = None - -try: - for cur_range in range(len(ranges)): - cur_iteration = 0 - skip_iteration = False - params = ranges[cur_range] - Eph.move(params[0]) - time.sleep(5.0) - Scienta.lowEnergy.write(params[1]) - Scienta.highEnergy.write(params[2]) - Scienta.update() - - Scienta.stepSize.write(params[3]) - Scienta.stepTime.write(params[4]) - Scienta.setIterations(1) - - set_adc_averaging() - - #iterations done in script - xdata = None - ydata = None - image_data = None - task = fork(plot_cur_spectrum) - - path="scan" + str(cur_range+1) + "/" - for cur_iteration in range(params[5]): - plots[cur_range+1].setTitle(str(params[0]) + " - iteration " + str(cur_iteration+1)) - while True: - wait_beam() - trig_scienta() - spectrum_array = Scienta.spectrum.read() - if beam_ok: - break - if ydata is None: - ydata = spectrum_array - else: - for k in range (len(spectrum_array)): - ydata[k] = ydata[k] + spectrum_array[k] - if xdata is None: - xdata = Scienta.spectrumX - plots[cur_range+1].getSeries(0).setData(xdata, ydata) - if skip_iteration: - break - save_dataset(path + "ScientaSpectrum", ydata) - set_attribute(path, "Iterations",cur_iteration+1) - if cur_iteration==0: - save_dataset(path + "ScientaChannels", xdata) - set_attribute(path + "ScientaChannels", ATTR_WRITABLE_DIMENSION, 1) - set_attribute(path, "Range Low", params[1]) - set_attribute(path, "Range High", params[2]) - set_attribute(path, "Step Time", params[4]) - set_attribute(path, "Step Size", params[3]) - set_attribute(path, "Pass Energy", pass_energy) - set_attribute(path, "Readables", ["ScientaSpectrum",]) - set_attribute(path, "Writables", ["ScientaChannels",]) - create_diag_datasets(path) - append_diag_datasets(path) - - plots[cur_range+1].setTitle(str(params[0])) - ret.append((xdata, ydata)) - -finally: - cur_range = -1 - if not Scienta.isReady(): - Scienta.stop() - Scienta.update() - task[0].cancel(True) - if ENDSCAN: - after_scan() - -set_return(to_array(ret,'o')) \ No newline at end of file diff --git a/script/users/Granas/automise.py b/script/users/Granas/automise.py index 74f19e59..468e0a50 100644 --- a/script/users/Granas/automise.py +++ b/script/users/Granas/automise.py @@ -1,39 +1,7 @@ """ -2018-10-13 +2018-10-14 author: christoph Seitz """ -command_path_tmp = "/sls/X03DA/data/gac-x03da/Data1/2018/10/Granas/XPSstuff/commands/set_measure.txt" -print __name__ -for i in range(60): - time.sleep(4) - if os.path.exists(command_path_tmp): - cont = open(command_path_tmp).read() #reading command from file - if "manipulator spectrum O1s" in cont: - select_edge_tmp = "O1s " - execfile("/sls/X03DA/data/gac-x03da/pshell/home/script/users/Granas/ManipulatorScan.py") - elif "fermi edge O1s" in cont: - select_edge_tmp = "O1s " - execfile("/sls/X03DA/data/gac-x03da/pshell/home/script/users/Granas/XPSSpectrum.py") - elif "fermi edge C1s" in cont: - select_edge_tmp = "O1s " - execfile("/sls/X03DA/data/gac-x03da/pshell/home/script/users/Granas/XPSSpectrum.py") - elif "manipulator spectrum C1s" in cont: - select_edge_tmp = "C1s " - execfile("/sls/X03DA/data/gac-x03da/pshell/home/script/users/Granas/ManipulatorScan.py") - if "exit_loop": - break - -#printing the end to file -for i in range(3): - try: - print("loop is closed now") - open(path,'w').write("loop is closed now") - break - except: - print("ending loop failed") - print("trying again") - - \ No newline at end of file diff --git a/script/users/Granas/xps_measure.py b/script/users/Granas/xps_measure.py deleted file mode 100644 index 93351e0f..00000000 --- a/script/users/Granas/xps_measure.py +++ /dev/null @@ -1,21 +0,0 @@ -""" -author chritstoph seitz - -starting the xps measurement - -Fermi edge of C1s test -""" -ranges = [] - -#pass_energy = 20 #O1s -pass_energy = 50 #C1s - -save_scienta_image = True - -skip_iteration = 0 - -# (eph, min, max, step, time, iter) -#ranges.append((650.0, 645., 647.0, 0.1, 0.2, 10)) # O1s -ranges.append((390.0, 384.4, 387.0, 0.1, 0.2, 20)) # C1s -exec(open("XPSSpectrum.py").read()) -time.sleep(10) \ No newline at end of file diff --git a/script/users/Granas/xps_measure_2.py b/script/users/Granas/xps_measure_2.py deleted file mode 100644 index d3c31a2c..00000000 --- a/script/users/Granas/xps_measure_2.py +++ /dev/null @@ -1,154 +0,0 @@ -""" -author chritstoph seitz - -starting the xps measurement - -Fermi edge of C1s test -""" - -#my debug -def my_debug(str_): - open("/sls/X03DA/data/gac-03da/Data1/2018/10/Granas/XPSstuff/commands/debugging.txt",'a').write(time.strftime("%H:%M")+" "+ str_+"\n") - print(str_) - -""" -here the copy of XPSSpectrum starts - -""" - -#Parameters (global variables): -# ranges: list of RangeSelection havinf args = (step_size, step_time, iterations) -# pass_energy -# save_scienta_image -# -# skip_iteration: if set to 1 then skips after end of current iteration - -global ranges, pass_energy, skip_iteration, ENDSCAN -""" old settings -ranges = [] -# (eph, min, max, step, time, iter) -ranges.append((1300.0, 577.0, 593.0, 0.1, 0.2, 1700)) -ranges.append((1300.0, 713.0, 722.0, 0.1, 0.2, 1000)) -ranges.append((1300.0, 1294.5, 1297.0, 0.02, 1, 2)) -pass_energy = 50 -skip_iteration = False -ENDSCAN = True -""" - -ranges = [] - -select_edge_tmp = "C1s " -pass_energy = 20 #O1s -#save_scienta_image = True - -skip_iteration = False -ENDSCAN = True - -# (eph, min, max, step, time, iter) -if "O1s" in select_edge_tmp: - pass_energy = 50 #C1s - ranges.append((650.0, 645., 647.0, 0.1, 0.2, 10)) # O1s -elif "C1s" in select_edge_tmp: - ranges.append((390.0, 384.4, 387.0, 0.1, 0.2, 20)) # C1s - -from ch.psi.pshell.data.LayoutDefault import ATTR_WRITABLE_DIMENSION as ATTR_WRITABLE_DIMENSION - -cur_range = 0 -cur_iteration = 0 - -Scienta.acquisitionMode = Scienta.AcquisitionMode.Swept -ret=[] - -set_exec_pars(open = True) - -#Global arguments -Scienta.passEnergy = pass_energy - -names=[] -names.append("Online Spectrum") -for i in range(len(ranges)): - names.append(str(ranges[i][0])) -plots = plot(None, names) -spectrum_series = plots[0].getSeries(0) -def plot_cur_spectrum(): - global spectrum_series - try: - while get_context().state.running: - y = Scienta.spectrum.take(100) - x = Scienta.spectrumX - spectrum_series.setData(x, y) - time.sleep(1.0) - finally: - print "Stopping spectrum plotting" -task = None - -try: - for cur_range in range(len(ranges)): - cur_iteration = 0 - skip_iteration = False - params = ranges[cur_range] - Eph.move(params[0]) - time.sleep(5.0) - Scienta.lowEnergy.write(params[1]) - Scienta.highEnergy.write(params[2]) - Scienta.update() - - Scienta.stepSize.write(params[3]) - Scienta.stepTime.write(params[4]) - Scienta.setIterations(1) - - set_adc_averaging() - - #iterations done in script - xdata = None - ydata = None - image_data = None - task = fork(plot_cur_spectrum) - - path="scan" + str(cur_range+1) + "/" - for cur_iteration in range(params[5]): - plots[cur_range+1].setTitle(str(params[0]) + " - iteration " + str(cur_iteration+1)) - while True: - wait_beam() - trig_scienta() - spectrum_array = Scienta.spectrum.read() - if beam_ok: - break - if ydata is None: - ydata = spectrum_array - else: - for k in range (len(spectrum_array)): - ydata[k] = ydata[k] + spectrum_array[k] - if xdata is None: - xdata = Scienta.spectrumX - plots[cur_range+1].getSeries(0).setData(xdata, ydata) - if skip_iteration: - break - save_dataset(path + "ScientaSpectrum", ydata) - set_attribute(path, "Iterations",cur_iteration+1) - if cur_iteration==0: - save_dataset(path + "ScientaChannels", xdata) - set_attribute(path + "ScientaChannels", ATTR_WRITABLE_DIMENSION, 1) - set_attribute(path, "Range Low", params[1]) - set_attribute(path, "Range High", params[2]) - set_attribute(path, "Step Time", params[4]) - set_attribute(path, "Step Size", params[3]) - set_attribute(path, "Pass Energy", pass_energy) - set_attribute(path, "Readables", ["ScientaSpectrum",]) - set_attribute(path, "Writables", ["ScientaChannels",]) - create_diag_datasets(path) - append_diag_datasets(path) - - plots[cur_range+1].setTitle(str(params[0])) - ret.append((xdata, ydata)) - -finally: - cur_range = -1 - if not Scienta.isReady(): - Scienta.stop() - Scienta.update() - task[0].cancel(True) - if ENDSCAN: - after_scan() - -set_return(to_array(ret,'o')) \ No newline at end of file