yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #21082
Re: [Question #685296]: export data with NaN in two data files
Question #685296 on Yade changed:
https://answers.launchpad.net/yade/+question/685296
Jan Stránský posted a new comment:
There are several ways how to do this:
- some "manual" export
- save is as now and filter NaN values out by some postprocessing
- use several plot.data dicts
- ...
The third method:
###
from yade import plot
O.bodies.append(sphere((0,0,0),1))
newton.gravity = (0,0,-10)
O.engines += [PyRunner(iterPeriod=5,command="plot1()")]
O.engines += [PyRunner(iterPeriod=6,command="plot2()")]
def plot1():
plot.data = data1
plot.addData(i=O.iter,v=O.bodies[0].state.vel[2])
def plot2():
plot.data = data2
plot.addData(i=O.iter,p=O.bodies[0].state.pos[2])
data1 = {}
data2 = {}
O.run(100,True)
#
plot.data = data1
plot.saveDataTxt("data1.txt")
plot.data = data2
plot.saveDataTxt("data2.txt")
###
plot.addData and plot.saveDataTxt just uses plot.data dictionary, but
otherwise does not case about its history, origin etc..
cheers
Jan
--
You received this question notification because your team yade-users is
an answer contact for Yade.