Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/generate-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:

- name: Install dependencies
run: |
uv sync --group docs --group interactive
uv sync --group docs --group interactive --extra extras

- name: Build the documentation
run: |
Expand Down
34 changes: 20 additions & 14 deletions examples/applications/porosity.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "openpnm"
version = "3.6.1"
version = "3.6.1-dev3"
description = "A framework for conducting pore network modeling simulations of multiphase transport in porous materials"
authors = [{ name = "OpenPNM Team", email = "jgostick@gmail.com" }]
maintainers = [
Expand Down Expand Up @@ -220,7 +220,7 @@ path = "src/openpnm/__version__.py"
packages = ["src/openpnm"]

[tool.bumpversion]
current_version = "3.6.1"
current_version = "3.6.1-dev3"
parse = """(?x)
(?P<major>0|[1-9]\\d*)\\.
(?P<minor>0|[1-9]\\d*)\\.
Expand Down
2 changes: 1 addition & 1 deletion src/openpnm/_skgraph/queries/_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def find_connected_nodes(network, inds, flatten=True, logic="or"):
if len(inds):
temp = temp.astype(float)
temp[inds] = np.nan
temp = np.reshape(temp, newshape=[len(edges), 2], order="F")
temp = np.reshape(temp, [len(edges), 2], order="F")
neighbors = temp
else:
neighbors = [np.array([], dtype=np.int64) for i in range(len(edges))]
Expand Down
49 changes: 32 additions & 17 deletions src/openpnm/visualization/_plottools.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,23 +148,27 @@ class of matplotlib, so check their documentation for additional
throat_pos = np.column_stack((xyz[P1], xyz[P2])).reshape((Ts.size, 2, dim.sum()))

# Deal with optional style related arguments
if 'c' in kwargs.keys():
color = kwargs.pop('c')
color = mcolors.to_rgb(color) + tuple([alpha])
if isinstance(cmap, str):
try:
cmap = plt.colormaps.get_cmap(cmap)
except AttributeError:
cmap = plt.cm.get_cmap(cmap)
kwargs['cmap'] = cmap
# Override colors with color_by if given
if color_by is not None:
if color_by is None:
if 'c' in kwargs.keys():
color = kwargs.pop('c')
color = mcolors.to_rgb(color) + tuple([alpha])
kwargs['color'] = color
_ = kwargs.pop('cmap', None)
else:
color_by = np.array(color_by)
if len(color_by) != len(Ts):
color_by = color_by[Ts]
if not np.all(np.isfinite(color_by)):
color_by[~np.isfinite(color_by)] = 0
logger.warning('nans or infs found in color_by array, setting to 0')
color = color_by
kwargs['array'] = color_by
if size_by is not None:
if len(size_by) != len(Ts):
size_by = size_by[Ts]
Expand All @@ -180,13 +184,22 @@ class of matplotlib, so check their documentation for additional
vmax = kwargs.pop('vmax', None)

if ThreeD:
lc = Line3DCollection(throat_pos, array=color, cmap=cmap, alpha=alpha,
linestyles=linestyle, linewidths=linewidth,
antialiaseds=np.ones_like(network.Ts), **kwargs)
lc = Line3DCollection(
throat_pos,
alpha=alpha,
linestyles=linestyle,
linewidths=linewidth,
antialiaseds=np.ones_like(network.Ts),
**kwargs,
)
else:
lc = LineCollection(throat_pos, array=color, cmap=cmap, alpha=alpha,
linestyles=linestyle, linewidths=linewidth,
antialiaseds=np.ones_like(network.Ts), **kwargs)
lc = LineCollection(
throat_pos, alpha=alpha,
linestyles=linestyle,
linewidths=linewidth,
antialiaseds=np.ones_like(network.Ts),
**kwargs,
)
if label_by is not None:
for count, (P1, P2) in enumerate(network.conns[Ts, :]):
i, j, k = np.mean(network.coords[[P1, P2], :], axis=0)
Expand Down Expand Up @@ -332,23 +345,26 @@ def plot_coordinates(network,
Xl, Yl, Zl = network['pore.coords'].T

# Parse formatting kwargs
if 'c' in kwargs.keys():
color = kwargs.pop('c')
if 's' in kwargs.keys():
markersize = kwargs.pop('s')
if isinstance(cmap, str):
try:
cmap = plt.colormaps.get_cmap(cmap)
except AttributeError:
cmap = plt.cm.get_cmap(cmap)
if color_by is not None:
kwargs['cmap'] = cmap
if color_by is None:
if 'c' in kwargs.keys():
color = kwargs.pop('c')
_ = kwargs.pop('cmap')
else:
color_by = np.array(color_by)
if len(color_by) != len(Ps):
color_by = color_by[Ps]
if not np.all(np.isfinite(color_by)):
color_by[~np.isfinite(color_by)] = 0
logger.warning('nans or infs found in color_by array, setting to 0')
color = color_by
if 's' in kwargs.keys():
markersize = kwargs.pop('s')
if size_by is not None:
if len(size_by) != len(Ps):
size_by = size_by[Ps]
Expand All @@ -375,7 +391,6 @@ def plot_coordinates(network,
s=markersize,
marker=marker,
alpha=alpha,
cmap=cmap,
**kwargs)
if label_by is not None:
for count, (i, j, k) in enumerate(network.coords[Ps, :]):
Expand Down
Loading