Closedown

This commit is contained in:
gac-x03da
2019-05-28 13:55:53 +02:00
parent 9cfa0ca678
commit 4be323f5a0

View File

@@ -34,7 +34,11 @@ for i in range(len(ranges)):
plots = plot(None, names)
for p in plots[1:]:
p.getAxis(p.AxisId.X).label = "kinetic energy"
p.getAxis(p.AxisId.X).label = "kinetic energy"
p.getAxis(p.AxisId.X2).setLabel("binding energy")
#p.getAxis(p.AxisId.X2).inverted = True
"""
eb_axis = NumberAxis("binding energy")
eb_axis.inverted = True
jf = p.chart.plot
@@ -43,10 +47,11 @@ for p in plots[1:]:
jf.getDomainAxis(1).labelFont = jf.getDomainAxis(0).labelFont
jf.getDomainAxis(1).tickLabelPaint = jf.getDomainAxis(0).tickLabelPaint
jf.getDomainAxis(1).tickLabelFont = jf.getDomainAxis(0).tickLabelFont
"""
# online spectrum
"""
p = plots[0]
spectrum_series = p.getSeries(0)
jf = p.chart.plot
@@ -73,36 +78,53 @@ def set_online_spectrum_x2_range():
spectrum_eb_axis.setRange(eb2, eb1)
set_online_spectrum_x2_range()
"""
p = plots[0]
spectrum_series = p.getSeries(0)
p.getAxis(p.AxisId.X2).setLabel("binding energy")
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:
while get_context().state.running:
y = Scienta.spectrum.take(100)
x = Scienta.spectrumX
spectrum_series.setData(x, y)
# adjust the binding energy scale
# if Eph returns an invalid number, we take energy_high as photon energy
ephot = Eph.take(100)
elo = Scienta.lowEnergy.take(100)
ehi = Scienta.highEnergy.take(100)
workfunc = 4.5
if ephot is not float or ephot < 0.:
ephot = ehi
eb1 = ephot - elo - workfunc
eb2 = ephot - ehi - workfunc
spectrum_eb_axis.setRange(eb2, eb1)
time.sleep(1.0)
finally:
print "Stopping spectrum plotting"
ephot = Eph.take(100)
elo = Scienta.lowEnergy.take(100)
ehi = Scienta.highEnergy.take(100)
workfunc = 4.5
if ephot is not float or ephot < 0.:
ephot = ehi
eb1 = ephot - elo - workfunc
eb2 = ephot - ehi - workfunc
plots[0].getAxis(p.AxisId.X2).setRange(eb2, eb1)
#
#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:
# while get_context().state.running:
# y = Scienta.spectrum.take(100)
# x = Scienta.spectrumX
# spectrum_series.setData(x, y)
#
# # adjust the binding energy scale
# # if Eph returns an invalid number, we take energy_high as photon energy
# ephot = Eph.take(100)
# elo = Scienta.lowEnergy.take(100)
# ehi = Scienta.highEnergy.take(100)
# workfunc = 4.5
# if ephot is not float or ephot < 0.:
# ephot = ehi
# eb1 = ephot - elo - workfunc
# eb2 = ephot - ehi - workfunc
# spectrum_eb_axis.setRange(eb2, eb1)
#
# time.sleep(1.0)
# finally:
# print "Stopping spectrum plotting"
#
def plot_cur_spectrum():
try:
@@ -110,7 +132,7 @@ def plot_cur_spectrum():
y = Scienta.spectrum.take(100)
x = Scienta.spectrumX
spectrum_series.setData(x, y)
set_online_spectrum_x2_range()
#set_online_spectrum_x2_range()
time.sleep(1.0)
finally:
print "Stopping spectrum plotting"
@@ -165,7 +187,7 @@ try:
# adjust the binding energy scale
# if Eph returns an invalid number, we take energy_high as photon energy
eb_axis = p.chart.plot.getDomainAxis(1)
#eb_axis = p.chart.plot.getDomainAxis(1)
ephot = Eph.take(100)
elo = Scienta.lowEnergy.take(100)
ehi = Scienta.highEnergy.take(100)
@@ -173,8 +195,9 @@ try:
if ephot is not float or ephot < 0.:
ephot = ehi
eb1 = ephot - elo - workfunc
eb2 = ephot - ehi - workfunc
eb_axis.setRange(eb2, eb1)
eb2 = ephot - ehi - workfunc
#eb_axis.setRange(eb2, eb1)
p.getAxis(p.AxisId.X2).setRange(eb2, eb1)
if save_scienta_image:
image_array = Scienta.dataMatrix.read()