porosity_by_type#
import matplotlib.pyplot as plt
import numpy as np
import porespy as ps
ps.visualization.set_mpl_style()
im#
im = ps.generators.blobs([200, 200], porosity=0.5, blobiness=2, seed=0)
eps_surface = ps.filters.find_surface_pores(im)
eps_closed = ps.filters.find_closed_pores(im)
fig, ax = plt.subplots(1, 3, figsize=[12, 4])
ax[0].imshow(im)
ax[0].axis(False)
ax[1].imshow(eps_surface)
ax[1].axis(False)
ax[2].imshow(eps_closed)
ax[2].axis(False);
eps = ps.metrics.porosity_by_type(im)
print(eps)
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Results of porosity_by_type generated at Tue Nov 25 22:01:40 2025
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
total 0.5
closed 0.03295
surface 0.128225
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――