Correct GraphicsItem to use relative import of lru_cache

Update MultiPlotSpeedTest to test lru_cache performance
This commit is contained in:
Luke Campagnola 2014-03-05 10:25:55 -05:00
parent dcb2c42179
commit 41c3d47d43
3 changed files with 17 additions and 7 deletions

View File

@ -22,17 +22,25 @@ p.setWindowTitle('pyqtgraph example: MultiPlotSpeedTest')
#p.setRange(QtCore.QRectF(0, -10, 5000, 20)) #p.setRange(QtCore.QRectF(0, -10, 5000, 20))
p.setLabel('bottom', 'Index', units='B') p.setLabel('bottom', 'Index', units='B')
nPlots = 10 nPlots = 100
nSamples = 500
#curves = [p.plot(pen=(i,nPlots*1.3)) for i in range(nPlots)] #curves = [p.plot(pen=(i,nPlots*1.3)) for i in range(nPlots)]
curves = [pg.PlotCurveItem(pen=(i,nPlots*1.3)) for i in range(nPlots)] curves = []
for c in curves: for i in range(nPlots):
c = pg.PlotCurveItem(pen=(i,nPlots*1.3))
p.addItem(c) p.addItem(c)
c.setPos(0,i*6)
curves.append(c)
rgn = pg.LinearRegionItem([1,100]) p.setYRange(0, nPlots*6)
p.setXRange(0, nSamples)
p.resize(600,900)
rgn = pg.LinearRegionItem([nSamples/5.,nSamples/3.])
p.addItem(rgn) p.addItem(rgn)
data = np.random.normal(size=(53,5000/nPlots)) data = np.random.normal(size=(nPlots*23,nSamples))
ptr = 0 ptr = 0
lastTime = time() lastTime = time()
fps = None fps = None
@ -42,7 +50,8 @@ def update():
count += 1 count += 1
#print "---------", count #print "---------", count
for i in range(nPlots): for i in range(nPlots):
curves[i].setData(i+data[(ptr+i)%data.shape[0]]) curves[i].setData(data[(ptr+i)%data.shape[0]])
#print " setData done." #print " setData done."
ptr += nPlots ptr += nPlots
now = time() now = time()

View File

@ -53,6 +53,7 @@ examples = OrderedDict([
('Video speed test', 'VideoSpeedTest.py'), ('Video speed test', 'VideoSpeedTest.py'),
('Line Plot update', 'PlotSpeedTest.py'), ('Line Plot update', 'PlotSpeedTest.py'),
('Scatter Plot update', 'ScatterPlotSpeedTest.py'), ('Scatter Plot update', 'ScatterPlotSpeedTest.py'),
('Multiple plots', 'MultiPlotSpeedTest.py'),
])), ])),
('3D Graphics', OrderedDict([ ('3D Graphics', OrderedDict([
('Volumetric', 'GLVolumeItem.py'), ('Volumetric', 'GLVolumeItem.py'),

View File

@ -4,7 +4,7 @@ from ..Point import Point
from .. import functions as fn from .. import functions as fn
import weakref import weakref
import operator import operator
from pyqtgraph.lru_cache import LRUCache from ..util.lru_cache import LRUCache
class GraphicsItem(object): class GraphicsItem(object):