← Back to team overview

yade-users team mailing list archive

Re: [Question #227428]: plot multiple plots at different iterPeriods

 

Question #227428 on Yade changed:
https://answers.launchpad.net/yade/+question/227428

    Status: Answered => Solved

Eugen Kubowsky confirmed that the question is solved:
@bruno: done ;) berlin is listed as user location. Are you sure about the wiki? what have you done to fix stability issues?
@Anton: Yes, I know how to observe the batch status using webbrowser of the simulating computer localhost:9080 by defaut. But thanks for asking ;) this is an amazing feature of Yade btw.

I solved my problem. The problem was at an other part of the code.
So it is indeed possible to use plot.addData() multiple times for your plots.

Heres an example of the saveGnuplot-Output of my data.
t, t_perf, and t_xyz represent simulated time (so called virtPeriod).
t and t_xyz are the same. I just added t_xyz because I want Fx,Fy and Fz be plotted in a diffrent window than Fmess and Fn.

You're right Bruno, the columns of the global yade plot table have to
have the same length. But calling plot.addData() will take care of it by
inserting 'nan' to all columns which are not specified inside the
brackets of addData().


# Fmess		Fn		Fx		Fy		Fz		speed		t		t_perf		t_xyz
nan	nan	nan	nan	nan	46.1	nan	1.0	nan
nan	nan	nan	nan	nan	43.5	nan	2.0	nan
nan	nan	nan	nan	nan	39.5	nan	3.0	nan
nan	nan	nan	nan	nan	39.4	nan	4.0	nan
nan	nan	nan	nan	nan	39.9	nan	5.0	nan
0.0106798197616	0.00806601710035	-0.0290951885327	0.0106798197616	0.147109672769	nan	6.0	nan	6.0
nan	nan	nan	nan	nan	39.1	nan	6.0	nan
nan	nan	nan	nan	nan	28.0	nan	6.001	nan
-0.0439469776697	0.00750723497695	-0.0125561404419	-0.0439471354583	0.144946720092	nan	6.002	nan	6.002

so it is possible to create to Engines that plot different data at different times.
Here's an example, maybe we can add it at the plot.addData documentation?

O.engines+=[ PyRunner(iterPeriod=1,command="myAddPlotData()", label='plotPlotter', dead=False),
 PyRunner(iterPeriod=2000,command="updatePerformancePlot()", label='performancePlotter', dead=False)]

#...data producing part
# In some cases it is useful to set the "dead" flag of one or both of the "plotengines" to True. Doing this you can start plotting at a certian time or iteration by changing the flag by e.g. plotPlotter.dead=True

plot.plots={'t':('Fn', 'Fmess',), 't_xyz':('Fx', 'Fy', 'Fz',), 't_perf':('speed',)} #creates 3 different plots
fig=plot.plot(noShow=True)#because I use batch mode I dont need the plots to be plotted, besides it will raise a warning
O.run(10000) #run 10000 iterations
O.wait()
plot.saveGnuplot(baseName='savedPlot')

def myAddPlotData():
   force=plot.addData(t=O.time, t_xyz=O.time,Fn=normalforce, Fmess=Fm, Fx=Fx,Fy=Fy,Fz=Fz)

def updatePerformancePlot():
   plot.addData(t_perf=O.time, speed=speeddata)

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.