Error in LookUpTableModule
Error relates to rounding of position to indices.
r_as_bin_indices
is achieved as follows current:
r_as_bin_indices = (r - r_min) / r_extent * n_bins
where r_extent = r_max - r_min
and n_bins
is the size of the lookup map
Examples
Consider the case where the map is [1 1.5 2 2.5 3 3.5]
. In this case, r_extent = 2.5
and n_bins = 6
.
Now if we were to look for the closest bin to r = 1.24
we would expect r_as_bin_indices = 0
after rounding.
However what we actually get is (1.24 - 1)/2.5 * 6 = 0.576
which rounds up to 1
If instead we use floor
instead of rounding, we get an issue in the case of r = 1.4
, where we would expect bin 0 but get bin 1.
Fix
Replace n_bins
from shape[]
to shape[] - 1