[SciPy-User] Efficient replacement to matlab textscan

josef.pktd at gmail.com josef.pktd at gmail.com
Wed Oct 5 22:06:26 EDT 2011


On Wed, Oct 5, 2011 at 9:57 PM, Tim Pitman <tapitman11 at gmail.com> wrote:
> Hi All,
>
> I'm working on a project which currently uses matlab to generate a
> real time plot which uses textscan
> (http://www.mathworks.com/help/techdoc/ref/textscan.html) to read a
> file with about 800 float values (all in one column but each on it's
> own line) every other point is the x value and the off values are the
> y values, totaling about 400 points. The function then plots all the
> points. This is done about 10 times per second providing a constantly
> updating graph. Matlab uses about 9% CPU when this is running. I'm
> trying to replace this with numpy/matplotlib in a wxPython app. My
> wxPython app runs at about 20% CPU without the plot running but once I
> start the plot at 10 updates per second CPU usage jumps up to %70
> percent. I'm currently using genfromtxt to read the file. I'm looking
> for suggestions on how to optimize this as much as possible.

numpy.loadtxt and reshape ?

genfromtxt tries to do a lot of inference about the file

Josef

>
> Thanks!
> Tim
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>



More information about the SciPy-User mailing list