Merge pull request #1110 from jkotan/nextafter2

fix for makeARGB error after #955
This commit is contained in:
Ogi Moore 2020-03-06 13:32:11 -08:00 committed by GitHub
commit f61d38ba8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1134,7 +1134,9 @@ def makeARGB(data, lut=None, levels=None, scale=None, useRGBA=False):
if minVal != 0 or maxVal != scale: if minVal != 0 or maxVal != scale:
if minVal == maxVal: if minVal == maxVal:
maxVal = np.nextafter(maxVal, 2*maxVal) maxVal = np.nextafter(maxVal, 2*maxVal)
data = rescaleData(data, scale/(maxVal-minVal), minVal, dtype=dtype) rng = maxVal-minVal
rng = 1 if rng == 0 else rng
data = rescaleData(data, scale/rng, minVal, dtype=dtype)
profile() profile()
# apply LUT if given # apply LUT if given