Some questions about pyqtgraph 2d graphic performance

305 views
Skip to first unread message

Jean Francois Leon

unread,
Feb 1, 2016, 2:32:41 PM2/1/16
to pyqtgraph
Hi
as a pyqtgraph user we have noticed the following:

We have an applicaiton that display 7 live plot eachplot having 2 or three curves each
along with 3 table widgets that display the last acquired value for each curve.

By the way our pyqtgraph is very simple straight adaptation of some of the exemples provided in the documentation.. 

Our experiment lasts for 12 hours. we have 20 signals acquired at 1 Hz during that time.

All that in a python script that receive the data from another process, treat it and do the graphical part ( so we use 2 python interpreters).
the qtevent loop as a 1000ms timer ( one refresh per second
The total time passed in the qt update routine as measured by time() is less than 5ms no matter what.

Nevertheless, after a couple of hours the effective refresh rate on screen drop gradually  to one image every 5 sec increasing to 10 sec or more after 3 hours.
The python routine apparently has not slowed down. ( again, each iteration last less than 5ms in the "python world")

if we close enough windows the refresh rate goes back to normal 1Hz..

We suspect the bottleneck is in the graphical engine that must be overwhelmed by the amount of data and drop refreshes as necessary...

are our data size too big (after 10 hours we have less than 1M points. so we dont thnk it should be a problem.)
is there any ways to accelerate the rendering from within pyqtgraph? 

 We are also aware of vispy but to the best of our knowledge it cannot really be used for "production" with pyqtgrap as of now

Our last resort will be to do some undersampling be we see it at the last resort as from time to time we need to zoom to observe a detail even in retrospect..

any suggestion or feedback from people that will have been through the same road?
Thanks
JF 

Luke Campagnola

unread,
Feb 1, 2016, 6:35:52 PM2/1/16
to pyqt...@googlegroups.com
It's difficult to tell from your description where exactly the bottleneck is; it might help to run a profiler for several seconds when it is running slowly to see what code is doing the most work. 

That said, if you are looking at data on the order of 1M points, then the plotting will probably slow down. You can use automatic downsampling and clipping to make this more efficient:

Luke


--
You received this message because you are subscribed to the Google Groups "pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyqtgraph+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/014116de-4a75-4941-b760-f01c3a007635%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jean Francois Leon

unread,
Feb 2, 2016, 1:20:04 AM2/2/16
to pyqtgraph
Hi Luke
Thanks for your input
Dowsampling work for us.
 We just realized with your post that maybe we can have some dynamic down sampling with pyqtgraph vs some hardcoded downsapling we were contemplating ( should the need arise we would like to retain a zooming capabilities to look " in retrospect" at some details.

Regarding profiler : we never used one.
A quick search shows there are many of them available. all fancy  with apparently different strengths.
Will it be possible to have some recomemndation or pointer based onother user experience of profiler use with pyqtgraph?

Luke Campagnola

unread,
Feb 3, 2016, 12:00:36 AM2/3/16
to pyqt...@googlegroups.com
I have found Python's built-in profilers work very well. Here's an example showing how you can enable a profiler for a brief period:

Note also: 

The total time passed in the qt update routine as measured by time() is less than 5ms no matter what.

Calling any of Qt's update() methods usually only schedules an update for later, so (as you found) you won't get an accurate performance metric by measuring the time for this call. For example: http://doc.qt.io/qt-4.8/qwidget.html#update

--
You received this message because you are subscribed to the Google Groups "pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyqtgraph+...@googlegroups.com.

Jean Francois Leon

unread,
Feb 3, 2016, 1:25:38 AM2/3/16
to pyqtgraph
Thanks a lot!
This is very helpful
JF
Reply all
Reply to author
Forward
0 new messages