ivoflipse / Pawlabeling

Tool for processing and analyzing pressure measurements
Other
18 stars 1 forks source link

Updating Matplotlib figures seems slow #43

Closed ivoflipse closed 10 years ago

ivoflipse commented 11 years ago

I use a vertical line to display in what part of the roll off we are, but it seems pretty slow. According to Joe Kington, this is because I redraw too much of the figure, where I should only redraw the parts that change, so I should be using blit:

http://stackoverflow.com/questions/8955869/why-is-plotting-with-matplotlib-so-slow http://stackoverflow.com/questions/10272478/why-does-my-pylab-animation-slow-down-with-each-update

ivoflipse commented 10 years ago

I've tried profiling the application, but couldn't get RunSnakeRun working (I blame wxPython) http://www.vrplumber.com/programming/runsnakerun/

ivoflipse commented 10 years ago

I've modified the code somewhat, such that change_frame is intercepted by the overarching widget, this checks whether its active and only then sends the relevant signal. Possibly, I could even change it so the signal is only send to the widget that's active. That means virtually no background work would be required. But for now I think its 'acceptable'.

ivoflipse commented 10 years ago

Turns out there's also a canvas.draw_idle function, that doesn't update for every event. Apparently the slider triggers the draw event a bit too often.

This SO answer explains it in a bit more detail, but it works very smoothly: http://stackoverflow.com/questions/16824718/python-matplotlib-pyside-fast-timetrace-scrolling