def test_encode_data_roundtrip():
minrand, maxrand = np.sort(np.random.randint(-427, 8848, 2))
testdata = np.round((np.sum(
np.dstack(
np.indices((512, 512),
dtype=np.float64)),
axis=2) / (511. + 511.)) * maxrand, 2) + minrand
baseval = -1000
interval = 0.1
rtripped = _decode(data_to_rgb(testdata.copy(), baseval, interval), baseval, interval)
assert testdata.min() == rtripped.min()
assert testdata.max() == rtripped.max()
评论列表
文章目录