← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2175: 1. Fix yade.plot broken in last commit

 

------------------------------------------------------------
revno: 2175
committer: Václav Šmilauer <eudoxos@xxxxxxxx>
branch nick: trunk
timestamp: Fri 2010-04-23 13:43:58 +0200
message:
  1. Fix yade.plot broken in last commit
  2. adjust interpolating-force example script
modified:
  py/plot.py
  scripts/test/interpolating-force.py


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription
=== modified file 'py/plot.py'
--- py/plot.py	2010-04-23 11:23:15 +0000
+++ py/plot.py	2010-04-23 11:43:58 +0000
@@ -11,8 +11,9 @@
 matplotlib.rc('axes',grid=True) # put grid in all figures
 import pylab
 
-"""Global dictionary containing all data values, common for all plots, in the form {'name':[value,...],...}. Data should be added using plot.addData function. All [value,...] columns have the same length, they are padded with NaN if unspecified."""
-# dictionary x-name -> (yspec,...), where yspec is either y-name or (y-name,'line-specification')
+"Global dictionary containing all data values, common for all plots, in the form {'name':[value,...],...}. Data should be added using plot.addData function. All [value,...] columns have the same length, they are padded with NaN if unspecified."
+data={}
+"dictionary x-name -> (yspec,...), where yspec is either y-name or (y-name,'line-specification')"
 plots={} # dictionary x-name -> (yspec,...), where yspec is either y-name or (y-name,'line-specification')
 "Dictionary converting names in data to human-readable names (TeX names, for instance); if a variable is not specified, it is left untranslated."
 labels={}

=== modified file 'scripts/test/interpolating-force.py'
--- scripts/test/interpolating-force.py	2010-01-10 09:09:32 +0000
+++ scripts/test/interpolating-force.py	2010-04-23 11:43:58 +0000
@@ -33,7 +33,7 @@
 	# without damping, the interaction never stabilizes and oscillates wildly… try it
 	NewtonIntegrator(damping=0.01),
 	# collect some data to plot periodically (every 50 steps)
-	PeriodicPythonRunner(iterPeriod=10,command='myAddPlotData()',label='plotDataCollector')
+	PeriodicPythonRunner(iterPeriod=10,command='myAddPlotData()')
 ]
 
 O.bodies.append([
@@ -47,7 +47,7 @@
 # callback for plotDataCollector
 import yade.plot as yp
 def myAddPlotData():
-	yp.addData({'t':O.time,'F_applied':forcer['force'],'supportReaction':O.actions.f(0)[2]})
+	yp.addData(t=O.time,F_applied=forcer.force,supportReaction=O.forces.f(0)[2])
 
 O.saveTmp()