Skip to content

Commit

Permalink
Merge pull request #980 from cmaloney111/dev
Browse files Browse the repository at this point in the history
Avoid overflow errors with _get_radial_sum #maint #bug
  • Loading branch information
jgostick authored Aug 22, 2024
2 parents 4b3b632 + 6bbac76 commit d6146fc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/porespy/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '3.0.0a0.dev13'
__version__ = '3.0.0a0.dev14'
8 changes: 4 additions & 4 deletions src/porespy/metrics/_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,11 +768,11 @@ def _radial_profile(autocorr, bins, pf=None, voxel_size=1):

@njit(parallel=False)
def _get_radial_sum(dt, bins, bin_size, autocorr):
radial_sum = np.zeros_like(bins[:-1])
radial_sum = np.zeros_like(bins[:-1], dtype=np.float64)
for i, r in enumerate(bins[:-1]):
mask = (dt <= r) * (dt > (r - bin_size[i]))
radial_sum[i] = np.sum(np.ravel(autocorr)[np.ravel(mask)], dtype=np.int64) \
/ np.sum(mask)
mask = (dt <= r) & (dt > (r - bin_size[i]))
if np.any(mask):
radial_sum[i] = np.sum(autocorr[mask], dtype=np.float64) / np.sum(mask, dtype=np.float64)
return radial_sum


Expand Down

0 comments on commit d6146fc

Please sign in to comment.