diff --git a/openpnm/_skgraph/generators/_voronoi_delaunay_dual.py b/openpnm/_skgraph/generators/_voronoi_delaunay_dual.py index 0742089944..876e2eabff 100644 --- a/openpnm/_skgraph/generators/_voronoi_delaunay_dual.py +++ b/openpnm/_skgraph/generators/_voronoi_delaunay_dual.py @@ -65,7 +65,7 @@ def voronoi_delaunay_dual( points=points, shape=shape, reflect=reflect, - f=1, + f=f, ) # Generate mask to remove any dims with all 0's diff --git a/openpnm/_skgraph/generators/tools/_funcs.py b/openpnm/_skgraph/generators/tools/_funcs.py index c5dcb00153..87f51ac151 100644 --- a/openpnm/_skgraph/generators/tools/_funcs.py +++ b/openpnm/_skgraph/generators/tools/_funcs.py @@ -150,7 +150,7 @@ def parse_points(shape, points, reflect=False, f=1): """ # Deal with input arguments - shape = np.array(shape, dtype=int) + shape = np.array(shape, dtype=float) if isinstance(points, int): points = generate_base_points(num_points=points, domain_size=shape, diff --git a/openpnm/models/misc/_neighbor_lookups.py b/openpnm/models/misc/_neighbor_lookups.py index 020f017a18..f3a32f2529 100644 --- a/openpnm/models/misc/_neighbor_lookups.py +++ b/openpnm/models/misc/_neighbor_lookups.py @@ -37,6 +37,8 @@ def from_neighbor_throats(target, prop, mode='min', ignore_nans=True): neighboring throats 'mean' Returns the value of the mean property of the neighboring throats + 'sum' Returns the sum of the property of the neighboring + throats =========== ===================================================== Returns @@ -69,6 +71,11 @@ def from_neighbor_throats(target, prop, mode='min', ignore_nans=True): if ignore_nans: np.subtract.at(counts, im.row, nans[im.col]) values = values/counts + if mode == 'sum': + if ignore_nans: + data[nans] = 0 + values = np.zeros((network.Np, )) + np.add.at(values, im.row, data[im.col]) return values @@ -98,6 +105,8 @@ def from_neighbor_pores(target, prop, mode='min', ignore_nans=True): neighboring pores 'mean' Returns the value of the mean property of the neighboring pores + 'sum' Returns the sum of the property of the neighrboring + pores =========== ===================================================== ignore_nans : bool (default is ``True``) @@ -122,6 +131,8 @@ def from_neighbor_pores(target, prop, mode='min', ignore_nans=True): value = np.amax(pvalues, axis=1) if mode == 'mean': value = np.mean(pvalues, axis=1) + if mode == 'sum': + value = np.sum(pvalues, axis=1) except np.AxisError: # Handle case of empty pvalues value = [] return np.array(value)