Skip to content

Commit

Permalink
adding sum to from_neigbhor_pores too
Browse files Browse the repository at this point in the history
  • Loading branch information
jgostick committed Oct 5, 2023
1 parent 26de1ed commit daff76f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions openpnm/models/misc/_neighbor_lookups.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,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``)
Expand All @@ -129,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)

0 comments on commit daff76f

Please sign in to comment.