71 lines
2.3 KiB
Python
71 lines
2.3 KiB
Python
#Parameters (global variables):
|
|
# ranges: list of RangeSelection havinf args = (step_size, step_time, iterations)
|
|
# pass_energy
|
|
#
|
|
# skip_iteration: if set to 1 then skips after end of current iteration
|
|
|
|
from ch.psi.pshell.data.ScanPersistenceStrategyDefault import ATTR_WRITABLE_DIMENSION as ATTR_WRITABLE_DIMENSION
|
|
|
|
if scienta.acquisitionMode == scienta.AcquisitionMode.Fixed:
|
|
scienta.acquisitionMode = scienta.AcquisitionMode.Swept
|
|
ret=[]
|
|
|
|
|
|
#Global arguments
|
|
scienta.passEnergy = pass_energy
|
|
|
|
xps_spectrum_step = 0
|
|
names=[]
|
|
for i in range(len(ranges)):
|
|
names.append(str(ranges[i]))
|
|
plots = plot(None, names)
|
|
try:
|
|
for i in range(len(ranges)):
|
|
skip_iteration = False
|
|
xps_spectrum_step = xps_spectrum_step+1
|
|
scienta.lowEnergy.put(ranges[i].min)
|
|
scienta.highEnergy.put(ranges[i].max)
|
|
scienta.update()
|
|
|
|
vars = ranges[i].vars
|
|
scienta.stepTime.write(vars[0])
|
|
scienta.stepSize.write(vars[1])
|
|
scienta.setIterations(1)
|
|
|
|
#iterations done in script
|
|
xdata = scienta.spectrumX
|
|
ydata = None
|
|
for j in range(vars[2]):
|
|
trig_scienta()
|
|
spectrum_array = scienta.spectrum.read()
|
|
if ydata is None:
|
|
ydata = spectrum_array
|
|
else:
|
|
for k in range (len(spectrum_array)):
|
|
ydata[k] = ydata[k] + spectrum_array[k]
|
|
plots[i].getSeries(0).setData(xdata, ydata)
|
|
if skip_iteration:
|
|
break
|
|
plots[i].setTitle(str(ranges[i]) + " - iteration " + str(j+1))
|
|
|
|
plots[i].setTitle(str(ranges[i]))
|
|
ret.append((xdata, ydata))
|
|
|
|
data1d = [1,2,3,4,5]
|
|
path="scan" + str(i+1) + "/"
|
|
save_dataset(path + "spectrum", ydata)
|
|
save_dataset(path + "channels", xdata)
|
|
set_attribute(path + "channels", ATTR_WRITABLE_DIMENSION, 1)
|
|
set_attribute(path, "Range Low", ranges[i].min)
|
|
set_attribute(path, "Range High", ranges[i].max)
|
|
set_attribute(path, "Step Time",vars[0])
|
|
set_attribute(path, "Step Size",vars[1])
|
|
set_attribute(path, "Pass Energy",pass_energy)
|
|
set_attribute(path, "Iterations",j+1)
|
|
|
|
|
|
finally:
|
|
xps_spectrum_step = 0
|
|
if not scienta.isReady():
|
|
scienta.stop()
|
|
set_return(to_array(ret,'o')) |