Script execution
This commit is contained in:
58
script/test/invoking2.py
Normal file
58
script/test/invoking2.py
Normal file
@@ -0,0 +1,58 @@
|
||||
|
||||
INVOKE_PLOT_UPDATES = True
|
||||
|
||||
p=None
|
||||
def start_plot():
|
||||
global p
|
||||
p = plot([None, None, None,None, None], ["TEY", "TFY", "TEYraw", "TFYraw", "I0"])
|
||||
|
||||
|
||||
def _update_plots(x, s0, s1, s2, s3, s4):
|
||||
p[0].getSeries(0).setData(x, s0)
|
||||
p[1].getSeries(0).setData(x, s1)
|
||||
p[2].getSeries(0).setData(x, s2)
|
||||
p[3].getSeries(0).setData(x, s3)
|
||||
p[4].getSeries(0).setData(x, s4)
|
||||
|
||||
def update_plot():
|
||||
global p
|
||||
#c = count.take()
|
||||
c=10
|
||||
if c is None:
|
||||
for i in range(len(p)):
|
||||
p[i].getSeries(0).clear()
|
||||
else:
|
||||
"""
|
||||
data.setSize(c)
|
||||
fdata.setSize(c)
|
||||
idata.setSize(c)
|
||||
edata.setSize(c)
|
||||
teyr= data.read()
|
||||
tfyr= fdata.read()
|
||||
i0 = idata.read()
|
||||
x = edata.read()
|
||||
"""
|
||||
teyr = [10,11,12,13,14,15,16,17,18,19]
|
||||
tfyr = [20,21,22,23,24,25,26,27,28,29]
|
||||
teyr = [30,31,32,33,34,35,36,37,38,39]
|
||||
i0 = [0,1,2,3,4,5,6,7,8,9]
|
||||
x = [0,1,2,3,4,5,6,7,8,9]
|
||||
|
||||
#from operator import truediv
|
||||
l = lambda x,y: (0.0 if (y==0.0) else x/y) #truediv
|
||||
tey=map(l, teyr, i0)
|
||||
tfy=map(l, tfyr, i0)
|
||||
|
||||
args = [ x, to_array(tey,'d'),
|
||||
to_array(tfy,'d'),
|
||||
to_array(teyr,'d'),
|
||||
to_array(tfyr,'d'),
|
||||
to_array(i0,'d')]
|
||||
if INVOKE_PLOT_UPDATES:
|
||||
invoke([_update_plots, args])
|
||||
else:
|
||||
_update_plots(*args)
|
||||
|
||||
start_plot()
|
||||
for i in range(10):
|
||||
update_plot()
|
||||
Reference in New Issue
Block a user