当前位置: 首页>>代码示例>>Python>>正文


Python plot.plot函数代码示例

本文整理汇总了Python中yade.plot.plot函数的典型用法代码示例。如果您正苦于以下问题:Python plot函数的具体用法?Python plot怎么用?Python plot使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了plot函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: initTest

def initTest():
	global mode
	print "init"
	if O.iter>0:
		O.wait();
		O.loadTmp('initial')
		print "Reversing plot data"; plot.reverseData()
	else: plot.plot(subPlots=False)
	strainer.strainRate=abs(strainRateTension) if mode=='tension' else -abs(strainRateCompression)
	try:
		from yade import qt
		renderer=qt.Renderer()
		renderer.dispScale=(1000,1000,1000) if mode=='tension' else (100,100,100)
	except ImportError: pass
	print "init done, will now run."
	O.step(); # to create initial contacts
	# now reset the interaction radius and go ahead
	ss2sc.interactionDetectionFactor=1.
	is2aabb.aabbEnlargeFactor=1.

	O.run()
开发者ID:Sotrelius,项目名称:trunk,代码行数:21,代码来源:uniax.py

示例2: plot

	def plot(self):
		try:
			from yade import plot
			if len(plot.plots)==0: return None
			fig=plot.plot(subPlots=True,noShow=True)
			img=O.tmpFilename()+'.'+plotImgFormat
			sqrtFigs=math.sqrt(len(plot.plots))
			fig.set_size_inches(5*sqrtFigs,7*sqrtFigs)
			fig.savefig(img)
			f=open(img,'rb'); data=f.read(); f.close(); os.remove(img)
			#print 'returning '+plotImgFormat
			return xmlrpclib.Binary(data)
		except:
			print 'Error updating plots:'
			import traceback
			traceback.print_exc()
			return None
开发者ID:8803104,项目名称:trunk,代码行数:17,代码来源:remote.py

示例3: TranslationEngine

  TranslationEngine(translationAxis=[0,0,1],velocity=-2.0,ids=idTop,dead=False,label='translat'),
  
  CombinedKinematicEngine(ids=idTop,label='combEngine',dead=True) + 
    ServoPIDController(axis=[0,0,1],maxVelocity=2.0,iterPeriod=1000,ids=idTop,target=1.0e7,kP=1.0,kI=1.0,kD=1.0) + 
    RotationEngine(rotationAxis=(0,0,1), angularVelocity=10.0, rotateAroundZero=True, zeroPoint=(0,0,0)),
  PyRunner(command='addPlotData()',iterPeriod=1000, label='graph'),
  PyRunner(command='switchTranslationEngine()',iterPeriod=45000, nDo = 2, label='switchEng'),
]
O.step()
from yade import qt
qt.View()
r=qt.Renderer()
r.bgColor=1,1,1  

def addPlotData():
  fMove = Vector3(0,0,0)
  
  for i in idTop:
    fMove += O.forces.f(i)
  
  plot.addData(z=O.iter, pMove=fMove[2], pFest=fMove[2])

def switchTranslationEngine():
  print "Switch from TranslationEngine engine to ServoPIDController"
  translat.dead = True
  combEngine.dead = False
  


plot.plots={'z':('pMove','pFest')}; plot.plot()
开发者ID:DEMANY,项目名称:trunk,代码行数:30,代码来源:PIDController.py

示例4: quit

	jumper.rot=Quaternion(Vector3.UnitZ,1/(1e4*nSteps))

O.run(nSteps,True)
if mode=='mov':
	plot.plots={'zShift-DD':(
		#('epsT-DD','g-'),('epsT-Sc','r^'),
		('dist-DD','g-'),('dist-Sc','r^'),
		None,
		('sigmaT-DD','b-'),('sigmaT-Sc','m^')
		#('relResStr-DD','b-'),('relResStr-Sc','m^')
		#('epsN-DD','b-'),('epsN-Sc','m^')
	)}
elif mode=='rot':
	plot.plots={'zRot-DD':(
		('epsT-DD','g|'),('epsT-Sc','r-'),
		None,
		('sigmaT-DD','b-'),('sigmaT-Sc','mv')
	)}



if 1:
	f='/tmp/cpm-geom-'+mode+'.pdf'
	plot.plot(noShow=True,subPlots=False).savefig(f)
	print 'Plot saved to '+f
	quit()
else:
	plot.plot(subPlots=False)


开发者ID:linkgreencold,项目名称:trunk,代码行数:28,代码来源:cpm-dem3dof-scgeom.py

示例5: dataCollector

]

#### dataCollector
from yade import plot
plot.plots={'iterations':'v','x':'z'}

def dataCollector():
	R=O.bodies[refPoint]
	plot.addData(v=R.state.vel[2],z=R.state.pos[2],x=R.state.pos[0],iterations=O.iter,t=O.realtime)

#### joint strength degradation
stableIter=1000
stableVel=0.001
degrade=True
def jointStrengthDegradation():
	global degrade
	if degrade and O.iter>=stableIter and abs(O.bodies[refPoint].state.vel[2])<stableVel :
		print('Equilibrium reached \nJoint cohesion canceled now !', ' | iteration=', O.iter)
		degrade=False
	for i in O.interactions:
		if i.phys.isOnJoint : 
			if i.phys.isCohesive:
				i.phys.isCohesive=False
				i.phys.FnMax=0.
				i.phys.FsMax=0.

print('Seeking after an initial equilibrium state')
print('')
O.run(10000)
plot.plot()# note the straight trajectory (z(x) plot)during sliding step (before free fall) despite the discretization of joint plane with spheres
开发者ID:yade,项目名称:trunk,代码行数:30,代码来源:gravityBis.py

示例6:

  f3 = [0,0,0]
  f4 = [0,0,0]
  
  try:
    f1=O.forces.f(id12)
    f2=O.forces.f(id22)
    f3=O.forces.f(id32)
    f4=O.forces.f(id42)
  except:
    f1 = [0,0,0]
    f2 = [0,0,0]
    f3 = [0,0,0]
    f4 = [0,0,0]
  
  s1 = (O.bodies[id12].state.pos[2]-O.bodies[id11].state.pos[2])-(r1 + r2)
  s2 = (O.bodies[id22].state.pos[2]-O.bodies[id21].state.pos[2])-(r1 + r2)
  s3 = (O.bodies[id32].state.pos[2]-O.bodies[id31].state.pos[2])-(r1 + r2)
  s4 = (O.bodies[id42].state.pos[2]-O.bodies[id41].state.pos[2])-(r1 + r2)
  
    
  plot.addData(fc1=f1[2], sc1=-s1, fc2=f2[2], sc2=-s2, fc3=f3[2], sc3=-s3, fc4=f4[2], sc4=-s4)

plot.plots={'sc1':('fc1'), 'sc2':('fc2'), 'sc3':('fc3'), 'sc4':('fc4')}; plot.plot()

from yade import qt
qt.View()

O.run(320000)
O.wait()
plot.saveGnuplot('sim-data_LudigPM')
开发者ID:DEMANY,项目名称:trunk,代码行数:30,代码来源:LudingPM.py

示例7: defVisualizer

        return
    Fz = O.forces.f(plate.id)[2]
    plot.addData(
        Fz=Fz,
        w=plate.state.pos[2] - (-4*Diameter),
        unbalanced=unbalancedForce(),
        i=O.iter
    )


def defVisualizer():
   with open("data.dat","a") as f:
       for b in O.bodies:
           if isinstance(b.shape, Sphere):
               rData = "{x},{y},{z},{r},{w}\t".format(x = b.state.pos[0],
                                                y = b.state.pos[1],
                                                z = b.state.pos[2],
                                                r = b.shape.radius + b.state.dR,
                                                w = plate.state.pos[2]
                                               )
               f.write(rData)
       f.write("\n")



O.timingEnabled=True
O.run(1, True)
plot.plots={'w':('Fz', None)}
plot.plot()

开发者ID:Kubeu,项目名称:trunk,代码行数:29,代码来源:LOedometricDeform.py

示例8: specified

from yade import qt
qt.View()
qt.Controller()

############################################
##### now the part pertaining to plots #####
############################################

from yade import plot
## make one plot: step as function of fn
plot.plots={'un':('fn')}

## this function is called by plotDataCollector
## it should add data with the labels that we will plot
## if a datum is not specified (but exists), it will be NaN and will not be plotted

def myAddPlotData():
	if O.interactions[0,1].isReal:
		i=O.interactions[0,1]
		## store some numbers under some labels
		plot.addData(fn=i.phys.normalForce[0],step=O.iter,un=2*s0.shape.radius-s1.state.pos[0]+s0.state.pos[0],kn=i.phys.kn)	

O.run(100,True); plot.plot(subPlots=False)

## We will have:
## 1) data in graphs (if you call plot.plot())
## 2) data in file (if you call plot.saveGnuplot('/tmp/a')
## 3) data in memory as plot.data['step'], plot.data['fn'], plot.data['un'], etc. under the labels they were saved

开发者ID:DEMANY,项目名称:trunk,代码行数:28,代码来源:mindlin.py

示例9: NewtonIntegrator

  ),
  NewtonIntegrator(damping=0,gravity=[0,0,-9.81]),
  PyRunner(command='addPlotData()',iterPeriod=100),
]

vel=-0.50
O.bodies[id12].state.vel=[0,0,vel]
O.bodies[id22].state.vel=[0,0,vel]
O.bodies[id32].state.vel=[0,0,vel]

def addPlotData():
  s1 = (O.bodies[id12].state.pos[2]-O.bodies[id11].state.pos[2])-(r1+r2)
  s2 = (O.bodies[id22].state.pos[2]-O.bodies[id11].state.pos[2])-(r1+r2)
  s3 = (O.bodies[id32].state.pos[2]-O.bodies[id11].state.pos[2])-(r1+r2)
  plot.addData(mat1mat2=s1,mat1mat3=s2,mat2mat3=s3,it=O.iter)
  
  

plot.plots={'it':('mat1mat2','mat1mat3','mat2mat3')}; plot.plot()

O.step()
from yade import qt
qt.View()

print "Friction coefficient for id11 and id12 is %g"%(math.atan(O.interactions[id11,id12].phys.tangensOfFrictionAngle))
print "Friction coefficient for id21 and id22 is %g"%(math.atan(O.interactions[id21,id22].phys.tangensOfFrictionAngle))
print "Friction coefficient for id31 and id32 is %g"%(math.atan(O.interactions[id31,id32].phys.tangensOfFrictionAngle))

O.run(100000, True)
#plot.saveGnuplot('sim-data_')
开发者ID:DEMANY,项目名称:trunk,代码行数:30,代码来源:ViscElMatchMaker.py

示例10: ForceResetter

id1 = O.bodies.append(sphere(center=[0,0,2*r],radius=r,material=mat1))
id2 = O.bodies.append(geom.facetBox(center=(0,-16.0*r,-2*r),orientation=oriBody,extents=(r,17.0*r,0), material=mat1,color=(0,0,1)))

id3 = O.bodies.append(sphere(center=[10*r,0,2*r],radius=r,material=mat2))
id4 = O.bodies.append(geom.facetBox(center=(10*r,-16.0*r,-2*r),orientation=oriBody,extents=(r,17.0*r,0), material=mat2,color=(0,0,1)))

o.engines = [
  ForceResetter(),
  InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
  InteractionLoop(
    [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()],
    [Ip2_ViscElMat_ViscElMat_ViscElPhys()],
    [Law2_ScGeom_ViscElPhys_Basic()],
  ),
  NewtonIntegrator(damping=0,gravity=[0,0,-9.81]),
  PyRunner(command='addPlotData()',iterPeriod=10000, dead = False, label='graph'),
]

def addPlotData(): 
  f1 = [0,0,0]
  s1 = O.bodies[id1].state.pos[1]
  s2 = O.bodies[id3].state.pos[1]
  plot.addData(sc=O.time, fc1=s1, fc2=s2)
  
  

plot.plots={'sc':('fc1','fc2')}; plot.plot()

from yade import qt
qt.View()
开发者ID:ThomasSweijen,项目名称:yadesolute2,代码行数:30,代码来源:rotationalResistance.py

示例11: dataCollector

#### dataCollector
from yade import plot
plot.plots={'iterations':('v',)}
#plot.plots={'x':('z',)}
def dataCollector():
	R=O.bodies[refPoint]
	plot.addData(v=R.state.vel[2],z=R.state.pos[2],x=R.state.pos[0],iterations=O.iter,t=O.realtime)

#### joint strength degradation
stableIter=2000
stableVel=0.001
degrade=True
def jointStrengthDegradation():
    global degrade
    if degrade and O.iter>=stableIter and abs(O.bodies[refPoint].state.vel[2])<stableVel :
	print '!joint cohesion total degradation!', ' | iteration=', O.iter
	degrade=False
	for i in O.interactions:
	    if i.phys.isOnJoint : 
		if i.phys.isCohesive:
		  i.phys.isCohesive=False
		  i.phys.FnMax=0.
		  i.phys.FsMax=0.

O.step()

print 'Seeking after an initial equilibrium state'
print ''
O.run(10000)
plot.plot()# note the straight line (during sliding step, before free fall) despite the discretization of joint plane with spheres
开发者ID:Sotrelius,项目名称:trunk,代码行数:30,代码来源:gravityBis.py

示例12: addPlotData

O.bodies[id2].state.vel=[0,0,vel]
O.bodies[id4].state.vel=[0,0,vel]
O.bodies[id6].state.vel=[0,0,vel]
O.bodies[id8].state.vel=[0,0,vel]
O.bodies[id10].state.vel=[0,0,vel]
O.bodies[id12].state.vel=[0,0,vel]

def addPlotData(): 
  f1=O.forces.f(id2)
  f2=O.forces.f(id4)
  f3=O.forces.f(id6)
  f4=O.forces.f(id8)
  f5=O.forces.f(id10)
  f6=O.forces.f(id12)
  
  s1 = (O.bodies[id2].state.pos[2]-O.bodies[id1].state.pos[2])-2*r
  sc=s1

  plot.addData(Willett_numeric=-f1[2], Willett_analytic=-f2[2], Rabinovich=-f3[2], Lambert=-f4[2], Weigert=-f5[2], Soulie=-f6[2], sc=sc)
  
  

plot.plots={'sc':('Willett_numeric','Willett_analytic','Rabinovich','Lambert','Weigert','Soulie')}; plot.plot()

O.step()
from yade import qt
qt.View()

O.run(250000, True)
#plot.saveGnuplot('sim-data_'+CapillarType1)
开发者ID:DEMANY,项目名称:trunk,代码行数:30,代码来源:capillar.py

示例13: int

  global iterN
  if (O.bodies[id2].state.vel[2]<0.0): 
    O.bodies[id2].state.vel*=-1.0
    cDir.iterPeriod = int(iterN/10000.0)
  elif (O.bodies[id2].state.pos[2]-O.bodies[id1].state.pos[2])-(r1 + r2) > 0.0:
    iterN = int(iterN*1.2)
    O.bodies[id2].state.vel[2]*=-1.0
    cDir.iterPeriod = iterN
    
def addPlotData(): 
  f = [0,0,0]
  sc = 0
  try:
    f=O.forces.f(id2)
  except:
    f = [0,0,0]
  
  s1 = (O.bodies[id2].state.pos[2]-O.bodies[id1].state.pos[2])-(r1 + r2)
  
  fc1 = f[2]
  sc1 = -s1/r1
    
  plot.addData(fc1=fc1, sc=sc1)

plot.plots={'sc':('fc1')}; plot.plot()

from yade import qt
qt.View()

plot.saveGnuplot('sim-data_LudigPM')
开发者ID:bcharlas,项目名称:trunk,代码行数:30,代码来源:LudingPM.py

示例14: ForceResetter

integratoreng.abs_err=1e-3;

# We use only the integrator engine

# Time step determines the exiting period of the integrator since the integrator performs one step from current_time to current_time+dt;

O.dt=1e-3;

O.engines=[
#		integratoreng,
		ForceResetter(),
#		Apply internal force to the deformable elements and internal force of the interaction element
		FEInternalForceEngine([If2_Lin4NodeTetra_LinIsoRayleighDampElast(),If2_2xLin4NodeTetra_LinCohesiveStiffPropDampElastMat()]),
		PyRunner(iterPeriod=1,command='applyforcetoelements()'),
		NewtonIntegrator(damping=0,gravity=[0,0,0]),
#		Plotting data: adds plots after one step of the integrator engine
		PyRunner(iterPeriod=1,command='addplot()')
	]

from yade import plot

plot.plots={'t':'vel','time':'pos','tm':'force','tt':'postail'}
plot.plot(subPlots=True)

try:
	from yade import qt
	qt.View()
	qt.Controller()
except ImportError: pass

开发者ID:yade,项目名称:trunk,代码行数:29,代码来源:testDeformableBodies_pressure.py

示例15: quit

	jumper.rot=Quaternion(Vector3.UnitZ,1/(1e4*nSteps))

O.run(nSteps,True)
if mode=='mov':
	plot.plots={'zShift-DD':(
		#('epsT-DD','g-'),('epsT-Sc','r^'),
		('dist-DD','g-'),('dist-Sc','r^'),
		None,
		('sigmaT-DD','b-'),('sigmaT-Sc','m^')
		#('relResStr-DD','b-'),('relResStr-Sc','m^')
		#('epsN-DD','b-'),('epsN-Sc','m^')
	)}
elif mode=='rot':
	plot.plots={'zRot-DD':(
		('epsT-DD','g|'),('epsT-Sc','r-'),
		None,
		('sigmaT-DD','b-'),('sigmaT-Sc','mv')
	)}



if 1:
	f='/tmp/cpm-geom-'+mode+'.pdf'
	plot.plot(noShow=True).savefig(f)
	print 'Plot saved to '+f
	quit()
else:
	plot.plot()


开发者ID:8803104,项目名称:trunk,代码行数:28,代码来源:cpm-dem3dof-scgeom.py


注:本文中的yade.plot.plot函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。