map_to_regions
#
Maps pore values from a network onto the image from which it was extracted
import matplotlib.pyplot as plt
import numpy as np
import openpnm as op
import porespy as ps
ws = op.Workspace()
ws.settings['loglevel'] = 50
np.random.seed(10)
ps.visualization.set_mpl_style()
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Cell In[1], line 3
1 import matplotlib.pyplot as plt
2 import numpy as np
----> 3 import openpnm as op
5 import porespy as ps
7 ws = op.Workspace()
ModuleNotFoundError: No module named 'openpnm'
Create image and extract network
#
Plot the pore network#
fig, ax = plt.subplots()
op.visualization.plot_connections(pn, c='w', linewidth=2, ax=ax)
op.visualization.plot_coordinates(pn, c='w', s=100, ax=ax)
plt.imshow(snow_output.regions.T, origin='lower')
plt.axis('off');
Now assign some values to the network:
pn['pore.values'] = np.random.rand(pn.Np)
And now assign these values to the image regions: