- representative_elementary_volume(im, npoints=1000)#
Calculates the porosity of an image as a function subdomain size.
This function extracts a specified number of subdomains of random size, then finds their porosity.
im (ndarray) – The image of the porous material
npoints (int) – The number of randomly located and sized boxes to sample. The default is 1000.
result – A custom object with the following data added as named attributes:
The total volume of each cubic subdomain tested
The porosity of each subdomain tested
These attributes can be conveniently plotted by passing the Results object to matplotlib’s
plotfunction using the * notation:
plt.plot(\*result, 'b.'). The resulting plot is similar to the sketch given by Bachmat and Bear 
- Return type:
This function is frustratingly slow. Profiling indicates that all the time is spent on scipy’s
sumfunction which is needed to sum the number of void voxels (1’s) in each subdomain.
Click here to view online example.