size_to_seq#

Converts values of invasion size 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()
[17:45:00] ERROR    PARDISO solver not installed, run `pip install pypardiso`. Otherwise,          _workspace.py:56
                    simulations will be slow. Apple M chips not supported.                                         

The arguments and default values for this function are:

import inspect
inspect.signature(ps.filters.size_to_seq)
<Signature (size, im=None, bins=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.filters.porosimetry(im)

size#

The sizes are produced by porosimetry for instance:

seq = ps.filters.size_to_seq(size=inv)
fig, ax = plt.subplots(1, 2, figsize=[12, 6])
ax[0].imshow(inv, origin='lower', interpolation='none')
ax[0].set_title('Invasion map by size')
ax[0].axis(False)
ax[1].imshow(seq, origin='lower', interpolation='none')
ax[1].set_title('Invasion map by sequence')
ax[1].axis(False);
../../../_images/578fcc1477ac04d12d5fde4ce70f5230cea9fe5929aa7f9281e84d1efb2ba179.png

im#

The boolean image can be optionally passed into so that uninvaded regions can be differentiated from solid (if both are labelled 0).

seq = ps.filters.size_to_seq(size=inv, im=im)
fig, ax = plt.subplots(1, 2, figsize=[12, 6])
ax[0].imshow(inv, origin='lower', interpolation='none')
ax[0].set_title('Invasion map by size')
ax[0].axis(False)
ax[1].imshow(seq, origin='lower', interpolation='none')
ax[1].set_title('Invasion map by sequence')
ax[1].axis(False);
../../../_images/825cd7e329830f12c45d9827472262de4bd18142f5fcfb52534a799db78eccda.png

In the right image above, there can be seen several regions that are isolated by the void space. They are colored yellow indicating they are filled last. This is caused by the fact that these regions were uninvaded so were set to 0, which makes them the last regions invaded. This may or may not be desired.

bins#

The number of sequence values to when converting sizes. The default is 25.

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

bins = 5
seq = ps.filters.size_to_seq(size=inv, bins=bins)
ax[0].imshow(seq, origin='lower', interpolation='none')
ax[0].set_title(f'bins = {bins}')
ax[0].axis(False)

bins = 25
seq = ps.filters.size_to_seq(size=inv, bins=bins)
ax[1].imshow(seq, origin='lower', interpolation='none')
ax[1].set_title(f'bins = {bins}')
ax[1].axis(False);
../../../_images/fc20874dc187f1d727fffa7c2f16b2e6ce1af7b855b21701e5c09f6c1b062bee.png