[SciPy-user] Read data file with scipy.io.read_array()

Ryan Krauss ryanfedora at comcast.net
Fri Jul 1 09:19:18 CDT 2005


I copied and pasted the data from your e-mail into a text file.  I had 
no problems reading it in - but python matrices use 0 as the first 
index, so I changed the second index to 4:

u=scipy.io.read_array('test.txt',columns=((0,4)))

and it worked fine. 

By the way, I ran it in ipython on windows and using the 5 index gave me 
a useful error message rather than a seg fault.

Guillem Borrell Nogueras wrote:

>Hi
>
>I need to read a data file written by a fortran executable and I'm
>triyng to do it with the read_array function.  The file is formatted
>this way:
>fortran format '(5(f10.6,x))'
>
>13.600905  11.536095   7.478742   1.529088  -1.705019
> 6.646662  21.875410  20.727882  10.592803   2.582046
>-1.615569  -4.082547  -5.376484  -4.660769  -2.616893
>-0.791246   0.842457   2.215573   3.311196   3.853060
>...
>
>I tried
>
>In [12]: u=read_array('udebug.out',columns=((0,5)))
>
>but gave me a segmentation fault.  Default options don't work for me. Is
>there a problem with spacings?
>
>Any ideas?
>
>Thanks in advance
>
>  
>



More information about the SciPy-user mailing list