PMEAL / porespy

A set of tools for characterizing and analying 3D images of porous materials
https://porespy.org
MIT License
301 stars 98 forks source link

Avoid overflow errors with _get_radial_sum #980

Closed cmaloney111 closed 1 month ago

cmaloney111 commented 2 months ago

The _get_radial_sum function currently overflows for large autocorrelation values. This can lead to negative values for the probability in the two_point_correlation function.

Problem When using the two_point_correlation function with large autocorrelation values, I encountered overflow errors:

Solution To fix this issue, I:

Two Point Correlation

jgostick commented 2 months ago

Thanks for this. This reminds me of another bug I fixed recently, where something np.sum(im) would use the dtype of im when doing the sum. I fixed it by specifying the dtype in the sum function, similar to what you did here. Thanks for catching this.

cmaloney111 commented 2 months ago

No problem!