satn_to_seq#

Converts values of invasion saturation into sequence numbers

import numpy as np
import porespy as ps
import matplotlib.pyplot as plt
from edt import edt
ps.visualization.set_mpl_style()
/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/openpnm/algorithms/_invasion_percolation.py:358: NumbaDeprecationWarning: The 'nopython' keyword argument was not supplied to the 'numba.jit' decorator. The implicit default value for this argument is currently False, but it will be changed to True in Numba 0.59.0. See https://numba.readthedocs.io/en/stable/reference/deprecation.html#deprecation-of-object-mode-fall-back-behaviour-when-using-jit for details.
  def _find_trapped_pores(inv_seq, indices, indptr, outlets):  # pragma: no cover

The arguments and default values for this function are:

import inspect
inspect.signature(ps.filters.satn_to_seq)
<Signature (satn, im=None, mode='drainage')>

Generate an image containing invasion sizes using the porosimetry function:

np.random.seed(0)
im = ps.generators.blobs([200, 200], porosity=0.5)
inv = ps.simulations.drainage(im=im, voxel_size=1, g=0)

satn#

seq = ps.filters.satn_to_seq(satn=inv.im_satn)
fig, ax = plt.subplots(1, 2, figsize=[12, 6])
ax[0].imshow(inv.im_satn/im, origin='lower', interpolation='none')
ax[0].set_title('Invasion map by saturation')
ax[0].axis(False)
ax[1].imshow(seq/im, origin='lower', interpolation='none')
ax[1].set_title('Invasion map by sequence')
ax[1].axis(False);
../../../_images/78b176b2900af75a66026264ebd85c14b3bb31432550de788067c58a2b77dc85.png

im#

Passing the boolean image lets the function correctly determine voxels that are solid vs uninvaded, which are both labelled 0.

fig, ax = plt.subplots(1, 2, figsize=[12, 6])

seq = ps.filters.satn_to_seq(satn=inv.im_satn)
ax[0].imshow(seq, origin='lower', interpolation='none')
ax[0].set_title('Invasion map by saturation')
ax[0].axis(False)

seq = ps.filters.satn_to_seq(satn=inv.im_satn, im=im)
ax[1].imshow(seq, origin='lower', interpolation='none')
ax[1].set_title('Invasion map by sequence')
ax[1].axis(False);
../../../_images/7ecda0bdd18c4cb022650bea75886170ef4a73dfad244f9d8dae751d5c42cddb.png