On Fri, Dec 3, 2010 at 8:34 PM, K. Larsen <kroy...@gmail.com> wrote:
> The LTSpice circuit simulation program outputs a file that looks like this:
>
> Freq. V(n003) V(n005) V(n007)
> 1.00000e+000 (-1.68072e+002dB,1.79085e+002°)
> (-1.71453e-006dB,-3.60000e-002°) (-8.40364e+001dB,8.99964e+001°)
> 1.07177e+000 (-1.66868e+002dB,1.79145e+002°)
> (-1.96947e-006dB,-3.85838e-002°) (-8.34343e+001dB,8.99961e+001°)
> 1.14870e+000 (-1.65664e+002dB,1.79202e+002°)
> (-2.26233e-006dB,-4.13531e-002°) (-8.28323e+001dB,8.99959e+001°)
> ...
>
>
Complicated text file formats like this can be a mess to deal with. One
trick I do to simplify the problem is to (if the files are not large) load
an entire file into a string and replace any un-needed characters with
whitespace. So, replacing the '"', 'dB', '(', ')', and ',' with a space
would yield:
1.00000e+000 -1.68072e+002 1.79085e+002 -1.71453e-006 -3.60000e-002
-8.40364e+001 8.99964e+001
1.07177e+000 -1.66868e+002 1.79145e+002 -1.96947e-006 -3.85838e-002
-8.34343e+001 8.99961e+001
1.14870e+000 -1.65664e+002 1.79202e+002 -2.26233e-006 -4.13531e-002
-8.28323e+001 8.99959e+001
Which could be put into a StringIO object, and then fed into numpy.loadtxt()
function to get your numpy arrays. Does that help?
Ben Root
------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users