pyqtgraph error for python3.5 with numpy1.11

301 views
Skip to first unread message

Yang Shize

unread,
Feb 25, 2016, 12:35:27 AM2/25/16
to pyqtgraph
Problem Description:
I copied the basic plotting example to a .py file and then run it.
Then the following error appears.


Traceback (most recent call last):
  File "D:\Python35\Quantifit-0975-150729\pyqttest4.py", line 36, in <module>
    p3.plot(np.random.normal(size=100), pen=(200,200,200), symbolBrush=(255,0,0), symbolPen='w')
  File "D:\Python35\lib\site-packages\pyqtgraph\graphicsItems\PlotItem\PlotItem.py", line 630, in plot
    item = PlotDataItem(*args, **kargs)
  File "D:\Python35\lib\site-packages\pyqtgraph\graphicsItems\PlotDataItem.py", line 176, in __init__
    self.setData(*args, **kargs)
  File "D:\Python35\lib\site-packages\pyqtgraph\graphicsItems\PlotDataItem.py", line 460, in setData
    self.updateItems()
  File "D:\Python35\lib\site-packages\pyqtgraph\graphicsItems\PlotDataItem.py", line 492, in updateItems
    self.scatter.setData(x=x, y=y, **scatterArgs)
  File "D:\Python35\lib\site-packages\pyqtgraph\graphicsItems\ScatterPlotItem.py", line 297, in setData
    self.addPoints(*args, **kargs)
  File "D:\Python35\lib\site-packages\pyqtgraph\graphicsItems\ScatterPlotItem.py", line 398, in addPoints
    self.updateSpots(newData)
  File "D:\Python35\lib\site-packages\pyqtgraph\graphicsItems\ScatterPlotItem.py", line 553, in updateSpots
    self.fragmentAtlas.getAtlas() # generate atlas so source widths are available.
  File "D:\Python35\lib\site-packages\pyqtgraph\graphicsItems\ScatterPlotItem.py", line 193, in getAtlas
    self.buildAtlas()
  File "D:\Python35\lib\site-packages\pyqtgraph\graphicsItems\ScatterPlotItem.py", line 186, in buildAtlas
    self.atlasData[x:x+w, y:y+h] = rendered[key]
IndexError: invalid slice

Yang Shize

unread,
Feb 25, 2016, 1:19:28 PM2/25/16
to pyqtgraph
Problem solved.

I forced the data type into int, then it is running.

Hope the developer will fix this issue in the future.

在 2016年2月25日星期四 UTC-5上午12:35:27,Yang Shize写道:

Guillaume_LOF

unread,
Dec 14, 2016, 11:51:21 AM12/14/16
to pyqtgraph
Hi,

  I actually encountered the same kind of error:

Traceback (most recent call last):

File "C:\Users\guillaume\Documents\scripts_python\skimage_blob.py", line 212, in process_one_image

update_appearence(param, changed)

File "C:\Users\guillaume\Documents\scripts_python\skimage_blob.py", line 261, in update_appearence

circles.setPoints(int64(blobs[:, 1]), int64(blobs[:, 0]), size = int64(blobs[:, 2]))

File "c:\applis\miniconda3\lib\site-packages\pyqtgraph\graphicsItems\ScatterPlotItem.py", line 411, in setPoints

return self.setData(*args, **kargs)

File "c:\applis\miniconda3\lib\site-packages\pyqtgraph\graphicsItems\ScatterPlotItem.py", line 297, in setData

self.addPoints(*args, **kargs)

File "c:\applis\miniconda3\lib\site-packages\pyqtgraph\graphicsItems\ScatterPlotItem.py", line 398, in addPoints

self.updateSpots(newData)

File "c:\applis\miniconda3\lib\site-packages\pyqtgraph\graphicsItems\ScatterPlotItem.py", line 553, in updateSpots

self.fragmentAtlas.getAtlas() # generate atlas so source widths are available.

File "c:\applis\miniconda3\lib\site-packages\pyqtgraph\graphicsItems\ScatterPlotItem.py", line 193, in getAtlas

self.buildAtlas()

File "c:\applis\miniconda3\lib\site-packages\pyqtgraph\graphicsItems\ScatterPlotItem.py", line 186, in buildAtlas

self.atlasData[x:x+w, y:y+h] = rendered[key]

TypeError: slice indices must be integers or None or have an __index__ method


I found based on your post a way to resolve the problem by adding [y, x, h, w] = np.int64([y, x, h, w]) at line 186 and also at line 148 of ScatterPlotItem.py file. But I am not found of modifying a file of a module as I shared my scripts with other people. Is there a way to prevent the problem without modifying ScatterPlotItem.py ?

The problem emerge since I updated numpy and matplotlib with numpy+mkl (version 1.12b01) and matplotlib (version 2.0.0rc1) you can find for windows x64 here: http://www.lfd.uci.edu/~gohlke/pythonlibs/
In both cases the cp35-cp35m-win_amd64.whl variant.

As you may have guessed with the path to my ScatterPlotItem.py file I am using python 3.5 with miniconda.

Thanks in advance for any clue that may help me on this one.

PS: in case someone want to reply me to change to an older version or keep miniconda version of numpy and matplotlib: these version raise a bug implying cycler in matplotlib with skimage blobs functions if I do not update the packages. So I am stuck on this one.
Reply all
Reply to author
Forward
0 new messages