1 2
import porespy as ps
2 2
import matplotlib.pyplot as plt
3

4

5
# Generate an image of spheres using the imgen class
6 2
im = ps.generators.blobs(shape=[500, 500], porosity=0.7, blobiness=1)
7 2
plt.figure(1)
8 2
plt.imshow(im)
9

10
# Chord length distributions
11 2
chords = ps.filters.apply_chords(im=im, trim_edges=False)
12 2
colored_chords = ps.filters.region_size(chords)
13 2
h = ps.metrics.chord_length_distribution(chords, bins=25)
14 2
ps.visualization.set_mpl_style()
15 2
fig, ax = plt.subplots(2, 2)
16 2
ax[0][0].imshow(im)
17 2
ax[0][1].imshow(chords)
18 2
ax[1][0].imshow(colored_chords, cmap=plt.cm.jet)
19 2
ax[1][1].bar(h.L, h.pdf, width=h.bin_widths, edgecolor='k')

Read our documentation on viewing source code .

Loading