i have data coming socket. want in beginning create empty image, update image every time receive data socket. problem when receive huge amount of data (1024) , want display it, takes time , hangs. possible speed little bit? think way problem, if knows better way please advise.
here's i'm doing:
in range(0,99): self.image_array[i] = np.zeros(shape=(y,x)) # y lines, x = points #values received array self.image_array[ch_id][line] = self.values socket ax1.imshow(self.image_array[ch_id],cmap='gray',interpolation='nearest', origin='lower') plt.draw() plt.clf()
when receive data possible instead of replacing data, appending or something? there better way initialize array instead of np.zeros(...
it's unnecessary create new image every time new data arrives socket. can create single image on initialisation, update values in array data receiving:
# on initialisation self.im = imshow(np.zeros((x,y)),cmap='gray',interpolation='nearest', origin='lower') ... # on update self.im.set_data(self.values) self.im.set_clim(self.values.min(),self.values.max()) self.im.figure.canvas.draw()
Comments
Post a Comment