Ignore NaN when checking data range in ImageView.

Merge remote-tracking branch 'zarch/bottleneck_range' into develop
This commit is contained in:
Luke Campagnola 2014-03-06 15:30:36 -05:00
commit c8f03e828e
4 changed files with 19 additions and 1 deletions

View File

@ -66,6 +66,7 @@ pyqtgraph-0.9.9 [unreleased]
- Fixed unicode support in Dock
- Fixed PySide crash caused by emitting signal from GraphicsObject.itemChange
- Fixed possible infinite loop from FiniteCache
- Allow images with NaN in ImageView
pyqtgraph-0.9.8 2013-11-24

View File

@ -28,6 +28,7 @@ Contributors
* Thomas S.
* Fabio Zadrozny
* Mikhail Terekhov
* Pietro Zambelli
Requirements
------------

View File

@ -33,6 +33,11 @@ from .. import debug as debug
from ..SignalProxy import SignalProxy
try:
from bottleneck import nanmin, nanmax
except ImportError:
from numpy import nanmin, nanmax
#try:
#from .. import metaarray as metaarray
#HAVE_METAARRAY = True
@ -526,7 +531,7 @@ class ImageView(QtGui.QWidget):
sl = [slice(None)] * data.ndim
sl[ax] = slice(None, None, 2)
data = data[sl]
return data.min(), data.max()
return nanmin(data), nanmax(data)
def normalize(self, image):
"""

View File

@ -0,0 +1,11 @@
import pyqtgraph as pg
import numpy as np
app = pg.mkQApp()
def test_nan_image():
img = np.ones((10,10))
img[0,0] = np.nan
v = pg.image(img)
app.processEvents()
v.window().close()