Merge pull request #356 from QuLogic/np-warnings

Fix some NumPy warnings
This commit is contained in:
Kenneth Lyons 2019-09-12 22:36:55 -07:00 committed by GitHub
commit fc9768be3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 15 deletions

View File

@ -103,6 +103,7 @@ def mkData():
dt = np.float dt = np.float
loc = 1.0 loc = 1.0
scale = 0.1 scale = 0.1
mx = 1.0
if ui.rgbCheck.isChecked(): if ui.rgbCheck.isChecked():
data = np.random.normal(size=(frames,width,height,3), loc=loc, scale=scale) data = np.random.normal(size=(frames,width,height,3), loc=loc, scale=scale)

View File

@ -58,17 +58,17 @@ class ImageExporter(Exporter):
filter.insert(0, p) filter.insert(0, p)
self.fileSaveDialog(filter=filter) self.fileSaveDialog(filter=filter)
return return
targetRect = QtCore.QRect(0, 0, self.params['width'], self.params['height']) w = int(self.params['width'])
sourceRect = self.getSourceRect() h = int(self.params['height'])
#self.png = QtGui.QImage(targetRect.size(), QtGui.QImage.Format_ARGB32)
#self.png.fill(pyqtgraph.mkColor(self.params['background']))
w, h = self.params['width'], self.params['height']
if w == 0 or h == 0: if w == 0 or h == 0:
raise Exception("Cannot export image with size=0 (requested export size is %dx%d)" % (w,h)) raise Exception("Cannot export image with size=0 (requested "
bg = np.empty((self.params['height'], self.params['width'], 4), dtype=np.ubyte) "export size is %dx%d)" % (w, h))
targetRect = QtCore.QRect(0, 0, w, h)
sourceRect = self.getSourceRect()
bg = np.empty((h, w, 4), dtype=np.ubyte)
color = self.params['background'] color = self.params['background']
bg[:,:,0] = color.blue() bg[:,:,0] = color.blue()
bg[:,:,1] = color.green() bg[:,:,1] = color.green()

View File

@ -8,7 +8,7 @@ class GLBarGraphItem(GLMeshItem):
pos is (...,3) array of the bar positions (the corner of each bar) pos is (...,3) array of the bar positions (the corner of each bar)
size is (...,3) array of the sizes of each bar size is (...,3) array of the sizes of each bar
""" """
nCubes = reduce(lambda a,b: a*b, pos.shape[:-1]) nCubes = np.prod(pos.shape[:-1])
cubeVerts = np.mgrid[0:2,0:2,0:2].reshape(3,8).transpose().reshape(1,8,3) cubeVerts = np.mgrid[0:2,0:2,0:2].reshape(3,8).transpose().reshape(1,8,3)
cubeFaces = np.array([ cubeFaces = np.array([
[0,1,2], [3,2,1], [0,1,2], [3,2,1],
@ -22,8 +22,5 @@ class GLBarGraphItem(GLMeshItem):
verts = cubeVerts * size + pos verts = cubeVerts * size + pos
faces = cubeFaces + (np.arange(nCubes) * 8).reshape(nCubes,1,1) faces = cubeFaces + (np.arange(nCubes) * 8).reshape(nCubes,1,1)
md = MeshData(verts.reshape(nCubes*8,3), faces.reshape(nCubes*12,3)) md = MeshData(verts.reshape(nCubes*8,3), faces.reshape(nCubes*12,3))
GLMeshItem.__init__(self, meshdata=md, shader='shaded', smooth=False)
GLMeshItem.__init__(self, meshdata=md, shader='shaded', smooth=False)