representative_elementary_volume

Import packages

[1]:
import matplotlib.pyplot as plt
import numpy as np
import porespy as ps

ps.visualization.set_mpl_style()
np.random.seed(10)

Genearate image for testing

[2]:
skel = ps.generators.blobs(shape=[500, 500])
im = ps.filters.prune_branches(skel)
fig, ax = plt.subplots()
ax.imshow(im, origin="lower");
../../../_images/examples_metrics_howtos_representative_elementary_volume_4_0.svg

Apply metric function

Output is a tuple with elements volume and porosity.

default

[3]:
npoints = 1000
profile = ps.metrics.representative_elementary_volume(im=im)
[17]:
fig, ax = plt.subplots()
ax.plot(profile.volume, profile.porosity, 'r.')
ax.set_xlabel("volume")
ax.set_ylabel("porosity");
../../../_images/examples_metrics_howtos_representative_elementary_volume_9_0.svg

Plot results:

npoints

[15]:
profile = ps.metrics.representative_elementary_volume(im=im, npoints=100)

Plot results:

[18]:
fig, ax = plt.subplots()
ax.plot(profile.volume, profile.porosity, 'r.')
ax.set_xlabel("volume")
ax.set_ylabel("porosity");
../../../_images/examples_metrics_howtos_representative_elementary_volume_14_0.svg