memory error

28 views
Skip to first unread message

Julien Gautier

unread,
Oct 26, 2019, 10:30:13 AM10/26/19
to pyqtgraph
hi

I have sometime a memory error when i using setImage
this is an example of my code :

self.Image=pg.GrraphicsLayoutWidget()
self.p1=self.winImage.addPlot()
self.imh=pg.ImageItem()
self.p1.addItem(self.imh)

while true :
self.imh.setImage(data.astype(float),autoLevels=True,autoDownsample=True)



and the error:
MemoryERROR: 
traceback(....)
file "./pyqtgraph/graphicsItems/ImageItem" , inn paint
self.render() 


Thanks

julien....@ensta.fr

unread,
Nov 5, 2019, 8:41:45 AM11/5/19
to pyqtgraph
in fact the error is the following :



Traceback (most recent call last):


File "C:\ProgramData\Anaconda3\lib\site-packages\pyqtgraph\graphicsItems\ImageItem.py", line 411, in paint

self.render()


File "C:\ProgramData\Anaconda3\lib\site-packages\pyqtgraph\graphicsItems\ImageItem.py", line 403, in render

argb, alpha = fn.makeARGB(image, lut=lut, levels=levels)


File "C:\ProgramData\Anaconda3\lib\site-packages\pyqtgraph\functions.py", line 1013, in makeARGB

data = rescaleData(data, scale/(maxVal-minVal), minVal, dtype=dtype)


File "C:\ProgramData\Anaconda3\lib\site-packages\pyqtgraph\functions.py", line 877, in rescaleData

d2 = np.clip(d2, lim.min, lim.max)


File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\core\fromnumeric.py", line 1958, in clip

return _wrapfunc(a, 'clip', a_min, a_max, out=out)


File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\core\fromnumeric.py", line 56, in _wrapfunc

return getattr(obj, method)(*args, **kwds)


MemoryError



Kenneth Lyons

unread,
Nov 5, 2019, 9:39:47 PM11/5/19
to pyqtgraph
A MemoryError indicates you're out of memory for some reason, so the traceback may not be all that helpful in determining why it's happening (np.clip may just happen to be where numpy tried to allocate some memory and failed). A more complete example that reproduces the error would be helpful, but I understand if that's not feasible (problem may go away outside the context of the bigger application). Any additional information on the structure of your program and how you're generating data would be useful in figuring out what's going on. It also couldn't hurt to have the output of `conda list` as well.
Reply all
Reply to author
Forward
0 new messages