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

hi all,
I tried to create polar interaction histogram using interaction-histogram.py 
for my simulation but the problem is that nothing is plotted in the output 
file. I'm using utils.plotDirections() at the same time and it works fine but I 
need to plot it myself. Can you please help me with this? thanks in advance.

I've defined a function to plot histogram at certain iterperiods. it is as 
follows:

def Intrhisto():
        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.

_______________________________________________
Mailing list: https://launchpad.net/~yade-users
Post to     : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp

Reply via email to