setDownsampling & PlotCurveItem

154 views
Skip to first unread message

noxfir...@gmail.com

unread,
May 25, 2017, 2:17:38 PM5/25/17
to pyqtgraph
Hello everyone,

I am currently struggling to use pyqtgraph for realtime ploting of 64 curves à >1k samples with a samplingrate of >1kHz. I found the "Multiple plots" example which shows the use of PlotCurveItem to increase the performance which really improves the update time. But as I draw every curve in a seperate plotwidget refresh rate is not as high as in the example. So I wanted to try downsampling. But if I call setDownsampling for a plot the following exception is generated:
Traceback (most recent call last):
 
File "C:\Python27\lib\site-packages\pyqtgraph\graphicsItems\PlotItem\PlotItem.py", line 952, in updateDownsampling
    c
.setDownsampling(ds, auto, method)
AttributeError: 'PlotCurveItem' object has no attribute 'setDownsampling'

Interestingly the program continues to run. To reproduce this behaviour just add p.setDownsampling(ds=True) to the Multiple plots" example e.g. in line after

p.setLabel('bottom', 'Index', units='B') .


best regards,


Nox

noxfir...@gmail.com

unread,
May 29, 2017, 5:29:46 AM5/29/17
to pyqtgraph
PS: Exception is thrown as well if example is left unchanged and downsampling is setup via GUI context menu.

vas...@gmail.com

unread,
May 29, 2017, 9:17:19 PM5/29/17
to pyqt...@googlegroups.com
You need to set Downsampling of PlotItem, not of PlotCurveItem.

# example
import pyqtgraph
graphics_layout_widget = pyqtgraph.GraphicsLayoutWidget()
plot_item = graphics_layout_widget.addPlot()
# this works well
plot_item.setDownsampling(auto=False, ds=2, mode='mean')
plot_curve_item = plot_item.plot()
# this produce an exception
# plot_curve_item.setDownsampling(auto=False, ds=2, mode='mean')


--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/7f4688ab-b194-4034-b626-adf4bad17d81%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

noxfir...@gmail.com

unread,
May 31, 2017, 9:16:40 AM5/31/17
to pyqtgraph
Hello,

Thank you for this very interesting hint and example code. Sadly using plot() instead of PlotCurveItem comes with a decreased performance. I measure ~50ms (plot) vs ~40ms (PlotCurveItem) per frame for Multiple plot example which is the reason why I started using PlotCurveItem in the first place. Of course the downsampling helps to catch up/surpass this effect but only for higher down sample rates. Additionally the issue remains that using the GUI context menu to set downsampling does raise an exception for the unmodified multiple plots example.

best regards



Am Dienstag, 30. Mai 2017 03:17:19 UTC+2 schrieb Vasilije Mehandzic:
You need to set Downsampling of PlotItem, not of PlotCurveItem.

# example
import pyqtgraph
graphics_layout_widget = pyqtgraph.GraphicsLayoutWidget()
plot_item = graphics_layout_widget.addPlot()
# this works well
plot_item.setDownsampling(auto=False, ds=2, mode='mean')
plot_curve_item = plot_item.plot()
# this produce an exception
# plot_curve_item.setDownsampling(auto=False, ds=2, mode='mean')

On Thu, May 25, 2017 at 8:17 PM, <noxfir...@gmail.com> wrote:
Hello everyone,

I am currently struggling to use pyqtgraph for realtime ploting of 64 curves à >1k samples with a samplingrate of >1kHz. I found the "Multiple plots" example which shows the use of PlotCurveItem to increase the performance which really improves the update time. But as I draw every curve in a seperate plotwidget refresh rate is not as high as in the example. So I wanted to try downsampling. But if I call setDownsampling for a plot the following exception is generated:
Traceback (most recent call last):
 
File "C:\Python27\lib\site-packages\pyqtgraph\graphicsItems\PlotItem\PlotItem.py", line 952, in updateDownsampling
    c
.setDownsampling(ds, auto, method)
AttributeError: 'PlotCurveItem' object has no attribute 'setDownsampling'

Interestingly the program continues to run. To reproduce this behaviour just add p.setDownsampling(ds=True) to the Multiple plots" example e.g. in line after

p.setLabel('bottom', 'Index', units='B') .


best regards,


Nox

--
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.
Reply all
Reply to author
Forward
0 new messages