rename private function and its arguments

This commit is contained in:
KIU Shueng Chuan 2021-06-16 06:50:51 +08:00
parent 7499c3b375
commit 5dcea9bdac

View File

@ -22,19 +22,19 @@ def rescaleData(data, scale, offset, dtype, clip):
return data_out
@numba.jit(nopython=True)
def rescale_and_lookup1d_function(xx, scale, offset, lut, yy):
def _rescale_and_lookup1d_function(data, scale, offset, lut, out):
vmin, vmax = 0, lut.shape[0] - 1
for r in range(xx.shape[0]):
for c in range(xx.shape[1]):
val = (xx[r, c] - offset) * scale
for r in range(data.shape[0]):
for c in range(data.shape[1]):
val = (data[r, c] - offset) * scale
val = min(max(val, vmin), vmax)
yy[r, c] = lut[int(val)]
out[r, c] = lut[int(val)]
def rescale_and_lookup1d(data, scale, offset, lut):
# data should be floating point and 2d
# lut is 1d
data_out = np.empty_like(data, dtype=lut.dtype)
rescale_and_lookup1d_function(data, float(scale), float(offset), lut, data_out)
_rescale_and_lookup1d_function(data, float(scale), float(offset), lut, data_out)
return data_out
@numba.jit(nopython=True)