Polar Histogram JCF Cracks

Asked by Luis Barbosa on 2020-11-17

Dear all,

I am plotting the polar histogram of cracks obtained using JCF in an dense aggregate.

However the polar histogram I am obtaining is not distributed over 360º, but only from 90 to 270º.

Here is the MWS:

import pylab # the matlab-like interface of matplotlib
pylab.ioff()
import numpy
import os.path
with open("cracks_shp.txt") as f:
   lines = f.readlines()
lines = [l.split()[7:10] for l in lines]
lines = [[float(v) for v in l] for l in lines]

angles = []
for a in lines:
 norm1=a[0]
 norm2=a[1]
 norm3=a[2]
 angles.append(atan(a[1]/a[0]))

pylab.hist(angles,bins=20)
# polar histogram
pylab.figure()
## prepare data
values,bins=numpy.histogram(angles,bins=20)
## prepare polar plot
pylab.subplot(111,polar=True);
## plot bar chart, with the histogram data
### bins has one edge extra, remove it: [:-1]
pylab.bar(left=bins[:-1],height=values,width=.7*pi/20);

pylab.show()

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
2020-11-17
Last reply:
2020-11-18
Jérôme Duriez (jduriez) said : #1

Hi,

There is no reason to distinguish between n and -n for a contact normal. Polar representations spanning 180° are then just fine, you do need to cover the 360°.

PS: the "W" in "MWS" is obviously insincere ;-)
FileNotFoundError: [Errno 2] No such file or directory: 'cracks_shp.txt'

Can you help with this problem?

Provide an answer of your own, or ask Luis Barbosa for more information if necessary.

To post a message you must log in.