load signed data joins problem

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 in “converters” option, but I haven’t found how to use it.
The other option I have found is using ‘readline’ of python

fin = open (file, ‘r’)
datos1 = fin.readline()
fin.close()

but I don’t know how to split it and it seems a very rude way of doing it.

Thank you very much

2009/4/22 Chloe Lewis <chlewis@…2456…>

···

Looks like all the numbers use the same number of characters – try splitting 16 characters at a time off, and then interpreting those substrings as numbers.

On Apr 21, 2009, at 21 Apr, 7:10 PM, darkside wrote:

Hi,
I found a problem loading data: I have a file of signed numbers like:

-1.370674456E+02-1.662854139E+02 0.000000000E+00 0.000000000E+00 0.000000000E+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 an error if I try to load this data.

Any idea of how to bypass it?

Thank you!


Stay on top of everything new and different, both inside and
around Java ™ technology - register by April 22, and save

$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today.
Use priority code J9JMT32. http://p.sf.net/sfu/p_______________________________________________

Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Chloe Lewis

Graduate student, Amundson Lab
Division of Ecosystem Sciences, ESPM
University of California, Berkeley
137 Mulford Hall - #3114
Berkeley, CA 94720-3114

chlewis@…2561…6…

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 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 in "converters" option, but I haven't found how to use it.
The other option I have found is using 'readline' of python

fin = open (file, 'r')
datos1 = fin.readline()
fin.close()

but I don't know how to split it and it seems a very rude way of doing it.

Thank you very much

<snip>