Closedown
This commit is contained in:
+2
-1
@@ -18,7 +18,8 @@ set_adc_averaging()
|
||||
set_preference(Preference.PLOT_TYPES, {'Scienta spectrum':1})
|
||||
|
||||
try:
|
||||
ascan((ManipulatorPhi, ManipulatorTheta), SENSORS, (PHI_RANGE[0], THETA_RANGE[0]), (PHI_RANGE[1], THETA_RANGE[1]), STEPS, LATENCY, RELATIVE, zigzag = ZIGZAG, before_read=before_readout, after_read = after_readout)
|
||||
ascan((ManipulatorPhi, ManipulatorTheta), SENSORS, (PHI_RANGE[0], THETA_RANGE[0]), (PHI_RANGE[1], THETA_RANGE[1]), STEPS, LATENCY, RELATIVE, zigzag = ZIGZAG, \
|
||||
before_read=before_readout, after_read = after_readout, compression = True)
|
||||
finally:
|
||||
if ENDSCAN:
|
||||
after_scan()
|
||||
+33
-8
@@ -31,7 +31,7 @@ for i in range(len(ranges)):
|
||||
names.append(str(ranges[i]))
|
||||
plots = plot(None, names)
|
||||
|
||||
for p in plots:
|
||||
for p in plots[1:]:
|
||||
p.getAxis(p.AxisId.X).label = "kinetic energy"
|
||||
eb_axis = NumberAxis("binding energy")
|
||||
eb_axis.inverted = True
|
||||
@@ -45,10 +45,15 @@ for p in plots:
|
||||
|
||||
# online spectrum
|
||||
|
||||
p = plots[0]
|
||||
spectrum_series = p.getSeries(0)
|
||||
spectrum_eb_axis = p.chart.plot.getDomainAxis(1)
|
||||
def plot_cur_spectrum():
|
||||
# p = plots[0]
|
||||
# spectrum_series = p.getSeries(0)
|
||||
# spectrum_eb_axis = p.chart.plot.getDomainAxis(1)
|
||||
def plot_cur_spectrum_eb():
|
||||
"""
|
||||
plot online spectrum function for forked task.
|
||||
with binding energy scale.
|
||||
issue: this should not set the axis while the plot is zoomed!
|
||||
"""
|
||||
global spectrum_series
|
||||
global spectrum_eb_axis
|
||||
try:
|
||||
@@ -72,6 +77,18 @@ def plot_cur_spectrum():
|
||||
time.sleep(1.0)
|
||||
finally:
|
||||
print "Stopping spectrum plotting"
|
||||
|
||||
def plot_cur_spectrum():
|
||||
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
|
||||
|
||||
|
||||
@@ -96,7 +113,7 @@ try:
|
||||
xdata = None
|
||||
ydata = None
|
||||
image_data = None
|
||||
task = fork(plot_cur_spectrum)
|
||||
task = fork(plot_cur_spectrum)
|
||||
|
||||
path="scan" + str(cur_range+1) + "/"
|
||||
for cur_iteration in range(vars[2]):
|
||||
@@ -107,6 +124,8 @@ try:
|
||||
trig_scienta()
|
||||
spectrum_array = Scienta.spectrum.read()
|
||||
if beam_ok:
|
||||
if image_data is None:
|
||||
(_width, _height) = Scienta.getImageSize()
|
||||
break
|
||||
if ydata is None:
|
||||
ydata = spectrum_array
|
||||
@@ -129,9 +148,15 @@ try:
|
||||
eb1 = ephot - elo - workfunc
|
||||
eb2 = ephot - ehi - workfunc
|
||||
eb_axis.setRange(eb2, eb1)
|
||||
|
||||
|
||||
if save_scienta_image:
|
||||
image_array = Scienta.dataMatrix.read()
|
||||
if _width != len(image_array[0]) or _height != len(image_array):
|
||||
err = "Scienta image size changed during the acquisition: " + str((len(image_array[0]), len(image_array))) + " - original: " + str((_width, _height))
|
||||
print err
|
||||
log(err)
|
||||
raise Exception(err)
|
||||
|
||||
if image_data is None:
|
||||
image_data = image_array
|
||||
else:
|
||||
@@ -143,7 +168,7 @@ try:
|
||||
save_dataset(path + "ScientaSpectrum", ydata)
|
||||
set_attribute(path, "Iterations",cur_iteration+1)
|
||||
if save_scienta_image:
|
||||
save_dataset(path + "ScientaImage", image_data)
|
||||
save_dataset(path + "ScientaImage", image_data, features = {"compression":True})
|
||||
if cur_iteration==0:
|
||||
save_dataset(path + "ScientaChannels", xdata)
|
||||
set_attribute(path + "ScientaChannels", ATTR_WRITABLE_DIMENSION, 1)
|
||||
|
||||
Reference in New Issue
Block a user