fixed bug in graphicsItems/ImageItem.py: degenerate images (max==min) would raise exception in getHistogram()

This commit is contained in:
Jim Crowell 2018-10-10 10:29:16 -04:00
parent 574c5f3a47
commit d261c2f0f2

View File

@ -487,6 +487,9 @@ class ImageItem(GraphicsObject):
if bins == 'auto':
mn = np.nanmin(stepData)
mx = np.nanmax(stepData)
if mx == mn:
# degenerate image, arange will fail
mx += 1
if np.isnan(mn) or np.isnan(mx):
# the data are all-nan
return None, None