Produces a movie of the invasion sequence from ibip filter. This method can be applied for visualizing image-based invasion percolation algorithm.

import matplotlib.pyplot as plt
import numpy as np
import porespy as ps
import inspect
from IPython.display import HTML
<Signature (im, satn, cmap='viridis', c_under='grey', c_over='white', v_under=0.001, v_over=1.0, fps=10, repeat=True)>


The input image is a Boolean image True values indicating the void voxels and False for solid. Let’s create a test image:

im = ps.generators.blobs(shape=[100,100], blobiness=1)
fig, ax = plt.subplots()
ax.imshow(im, origin='lower', interpolation='none')


The saturation image can be generated from ibip data using seq_to_satn method. The satn is the image of porous material where each voxel indicates the global saturation at which it was invaded. Voxels with 0 values indicate solid and and -1 indicate uninvaded.

bd = np.zeros_like(im, dtype=bool)
bd[:, 0] = 1
bd *= im
out = ps.filters.ibip(im=im, inlets=bd)
inv_seq, inv_size = out.inv_sequence, out.inv_sizes
satn = ps.filters.seq_to_satn(seq=inv_seq)
C:\Users\jeff\AppData\Local\Temp\ipykernel_20432\ DeprecationWarning: Call to deprecated function (or staticmethod) ibip. (The ibip function will be moved to the ``simulations`` module in a future version)
  out = ps.filters.ibip(im=im, inlets=bd)

Now we can create an animation of the invasion sequence using satn_to_movie: (To save animation as a file and for visualizing use

mov = ps.visualization.satn_to_movie(im=im, satn=satn)
mov_image_based_ip = mov.to_jshtml()