I've found a few errors in the Voronoi algorithm. I'm putting my fixes in this PR (it seems to be working fine now; at least in the sense that the results I get are consistent with what I expected), feel free to modify anything before merging. The errors were the following:
In the function get_coeff_var, the std (actually the variance) of the position was compared to the std of the momentum in SI units. This essentially made the tolerance for the momentum disregarded. Now the standard deviations are normalized by the tolerances so that we can safely compare the position std with the momentum std.
The function weighted_std actually returned the variance (the std squared). I've renamed this function weighted_variance for clarity and I've added a square root when it is called in get_coeff_var. I've also slightly modified this function so that it returns 0 when the length of the input array is 1 (otherwise it may return a (very small) negative number due to machine precision errors, which turn into a nan when performing the above-mentioned square-root).
Hello!
I've found a few errors in the Voronoi algorithm. I'm putting my fixes in this PR (it seems to be working fine now; at least in the sense that the results I get are consistent with what I expected), feel free to modify anything before merging. The errors were the following:
In the function
get_coeff_var
, the std (actually the variance) of the position was compared to the std of the momentum in SI units. This essentially made the tolerance for the momentum disregarded. Now the standard deviations are normalized by the tolerances so that we can safely compare the position std with the momentum std.The function
weighted_std
actually returned the variance (the std squared). I've renamed this functionweighted_variance
for clarity and I've added a square root when it is called inget_coeff_var
. I've also slightly modified this function so that it returns 0 when the length of the input array is 1 (otherwise it may return a (very small) negative number due to machine precision errors, which turn into anan
when performing the above-mentioned square-root).