[SciPy-User] Can loadtxt do this: complex file format

François Beaubert francois.beaubert@univ-valenciennes...
Fri Nov 23 08:33:56 CST 2012


Hi alll,

I'm wondering if loadtxt can be used to read a file with a rather 
complicated file format (well at least for me :))

I would like to read data in a file (100 000 lines) which contains the 
Ux, Uy and Uz velocity components versus time for different points (x, 
y, z coordinates).

  The file's format looks like this:

#               x                 0             0.005
#               y                 0            0.0025
#               z               0.3               0.3
#            Time
               100       (7.665475124e-05 -0.0002514304858 
0.07519945952)   (0.0007792405436 -0.001695097619 0.1563337147)
               200       (7.060958587e-05 -0.0002343546897 
0.07631018852)   (0.0007458315198 -0.001621335844 0.1705269028)
               300       (6.511531713e-05 -0.0002186820111 
0.07784758393)    (0.0007208548956 -0.001563533763 0.1811116196)
               400       (6.019627747e-05 -0.0002045291128 
0.07981817652)    (0.000700274915 -0.001515310657 0.1896792906)

The first column is ... the time
The 3 values in the first parentheses are the Ux, Uy and Uz velocity 
components on point 1, the values enclosed in the second parentheses are 
the Ux,Uy and Uz velocity components for point 2, etc

1. Is it possible to skip those parentheses to be able to read the data 
with loadtxt ?
2. Is it possible to store the points coordinates (referenced in the 
heading) in variables without a priori knowing the total numbers of 
positions ?

Sorry if it looks like to easy for you, but I"m a newbie in python
Any help will be welcome.

Thanks a lot !
Cheers
Francois
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20121123/f5ca76e3/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: francois_beaubert.vcf
Type: text/x-vcard
Size: 454 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/scipy-user/attachments/20121123/f5ca76e3/attachment.vcf 


More information about the SciPy-User mailing list