← Back to team overview

yade-users team mailing list archive

Re: [Question #247136]: interaction histogram

 

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

Sina Jafari gave more information on the question:
def Intrhisto():
	# axis normal to the plane in which we do the histogram
	axis=2 # x, i.e. plot the xy plane
	ax1,ax2=(axis+0)%3,(axis+1)%3 ## get the other two indices, i.e. 0 and 1 in this case
	angles,forces=[],[]
	for z in O.interactions:
		if not z.isReal: continue
		norm=z.geom.normal
		if norm[ax1]==0:
			angle=90
			force=z.phys.normalForce.norm()
		else:
			angle=np.arctan(norm[ax2]/norm[ax1])
			force=z.phys.normalForce.norm()
		angles.append(angle)
		forces.append(force)
	# polar histogram
	pylab.figure()
	## prepare data
	values,bins=numpy.histogram(angles,weights=forces,bins=20)
	## prepare polar plot
	pylab.subplot(111,polar=True);
	pylab.plot()
	pylab.savefig('Norm-Force-Histogram.JPEG')

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