Re: [Matplotlib-users] load signed data joins problem

2009-04-22 Thread Christopher Barker
darkside wrote: > Maybe because of the \n? Do I have to put them off before trying fromstring? yes == fromstring/fromfile doesn't deal with mixing \n and space (or any other sep char), which is too bad, because this is a common use. They could use some work in general. but if you do a: s = s.re

Re: [Matplotlib-users] load signed data joins problem

2009-04-22 Thread darkside
Thank your, but: If the initial list is: >>> a ' 0.0E+00 1.806088833E-02-4.959341557E+07 0.0E+00 0.0E+00\n' y = np.fromstring(a2,sep=' ') >>> y array([ 0.e+00, 1.80608883e-02, -4.95934156e+07, 0.e+00, 0.e+00]) It works perfectly. But

Re: [Matplotlib-users] load signed data joins problem

2009-04-22 Thread Jouni K . Seppänen
darkside writes: x = np.fromstring(b,sep='') That should be sep=' ' (a space) to make it read ASCII representations of numbers. Otherwise it will interpret the string as binary, and if the string length happens to be a multiple of 8, you get garbage data, otherwise it raises the following e

Re: [Matplotlib-users] load signed data joins problem

2009-04-22 Thread darkside
Thanks, your solution is very good. But I have still one problem: the last line makes this: >>> x = np.fromstring(b,sep='') >>> x array([ 8.56506822e-072, 2.92021791e-033, 2.25187638e+006, ..., 6.99021630e-077, 1.39804329e-076, 2.66133772e-260]) As you can see, it doesn't load t

Re: [Matplotlib-users] load signed data joins problem

2009-04-22 Thread Gary Ruben
How about f = open(file) s = f.read() f.close() a = s.replace('E-','EE').replace('-',' -').replace('EE','E-') x = np.fromstring(a, sep=' ') Gary R. darkside wrote: > I think that not all de numbers use the same number of characters, the > problem is the signed ones. This numbers use one more ch

Re: [Matplotlib-users] load signed data joins problem

2009-04-22 Thread darkside
I think that not all de numbers use the same number of characters, the problem is the signed ones. This numbers use one more character for '-' and join the previous column. Your idea is quite good, but I don't know how to do it: If I use the pylab.load code, I suppose that I have to put something i

[Matplotlib-users] load signed data joins problem

2009-04-21 Thread darkside
Hi, I found a problem loading data: I have a file of signed numbers like: -1.370674456E+02-1.662854139E+02 0.0E+00 0.0E+00 0.0E+00 6.964865599E+10 8.394798002E-11 4.348192658E+03 9.455873862E+02 3.292484968E-09 The problem is that the signed numbers join so I always find