corrections for 1d arrays

This commit is contained in:
Luke Campagnola 2014-09-26 15:25:05 -04:00
parent 4543031ac5
commit 9893fc3735
2 changed files with 12 additions and 6 deletions

View File

@ -91,12 +91,13 @@ class DiffTreeWidget(QtGui.QWidget):
#for i in np.argwhere(~eq):
else:
for i,k in enumerate(info.dtype.fields.keys()):
eq = self.compareArrays(a[k], b[k])
if not np.all(eq):
for n in tableNodes:
n.setBackground(0, fn.mkBrush(bad))
#for j in np.argwhere(~eq):
if a.dtype == b.dtype:
for i,k in enumerate(a.dtype.fields.keys()):
eq = self.compareArrays(a[k], b[k])
if not np.all(eq):
for n in tableNodes:
n.setBackground(0, fn.mkBrush(bad))
#for j in np.argwhere(~eq):
# dict: compare keys, then values where keys match
# list:

View File

@ -222,6 +222,8 @@ class TableWidget(QtGui.QTableWidget):
return self.iterate, list(map(asUnicode, data.dtype.names))
elif data is None:
return (None,None)
elif np.isscalar(data):
return self.iterateScalar, None
else:
msg = "Don't know how to iterate over data type: {!s}".format(type(data))
raise TypeError(msg)
@ -236,6 +238,9 @@ class TableWidget(QtGui.QTableWidget):
for x in data:
yield x
def iterateScalar(self, data):
yield data
def appendRow(self, data):
self.appendData([data])