[SciPy-user] read_array

Travis Oliphant "oliphant." at ee.byu.edu
Tue Jul 1 19:43:51 EDT 2003


Cliff Martin wrote:
> I'm trying to read a large ASCII file (each line has a carraige return) 
> with elements separated by spaces(it can be variable due to large number 
> differences). My code is below and the error message from the code 
> follows. By the way the size of the array is 223 by 221.  This read 
> works quite well with a smaller file.  What is the problem?
> 
> A = scipy.io.read_array('c:/transfer/av56tst1.int')
> Traceback (most recent call last):
>  File "<interactive input>", line 1, in ?
>  File "C:\Python22\Lib\site-packages\scipy\io\array_import.py", line 
> 369, in read_array
>    outarr[k][row] = vals[k]
> ValueError: matrices are not aligned for copy
> 

This looks like one of the lines is not the same as the others (or is 
not being interpreted as the same).  Are you sure each line has the same 
number of elements?  Are there lines with text on them?

If you send a copy of your file I can tell you specifically what's wrong.

-Travis O.




More information about the SciPy-User mailing list