examples: use integer division in indexing

In python3 / operator produces a float, which is not a valid index.
Replace with // integer division.
This commit is contained in:
Ilya A. Kriveshko 2018-03-30 14:48:05 -04:00
parent b421cc2790
commit 20bcc39eb1
2 changed files with 4 additions and 4 deletions

View File

@ -26,9 +26,9 @@ data += pg.gaussianFilter(np.random.normal(size=shape), (15,15,15))*15
## slice out three planes, convert to RGBA for OpenGL texture
levels = (-0.08, 0.08)
tex1 = pg.makeRGBA(data[shape[0]/2], levels=levels)[0] # yz plane
tex2 = pg.makeRGBA(data[:,shape[1]/2], levels=levels)[0] # xz plane
tex3 = pg.makeRGBA(data[:,:,shape[2]/2], levels=levels)[0] # xy plane
tex1 = pg.makeRGBA(data[shape[0]//2], levels=levels)[0] # yz plane
tex2 = pg.makeRGBA(data[:,shape[1]//2], levels=levels)[0] # xz plane
tex3 = pg.makeRGBA(data[:,:,shape[2]//2], levels=levels)[0] # xy plane
#tex1[:,:,3] = 128
#tex2[:,:,3] = 128
#tex3[:,:,3] = 128

View File

@ -17,7 +17,7 @@ app = QtGui.QApplication([])
frames = 200
data = np.random.normal(size=(frames,30,30), loc=0, scale=100)
data = np.concatenate([data, data], axis=0)
data = pg.gaussianFilter(data, (10, 10, 10))[frames/2:frames + frames/2]
data = pg.gaussianFilter(data, (10, 10, 10))[frames//2:frames + frames//2]
data[:, 15:16, 15:17] += 1
win = pg.GraphicsLayoutWidget(show=True)