Glenn Jones
January 19th, 2009, 05:40 PM
Hi,
So I've recently moved away from using matlab to use scientific python using predominantly pylab, numpy and scipy. I am however having difficultie in saving a mixed data format of the following structure:
# Header 1
# Header 2
x(1) y(1) z(1)
. . .
. . .
. . .
x(N) y(N) z(N)
I can save the header files quite easily using the following:
f=open('myfile.txt','w')
f.write('#Header1\n#Header2)
f.close
When I more myfile.txt I get
#Header1
#Header2
The difficultie I'm having is storing the array below the header. The x,y,z data is stored as a numpy.ndarray called XYZ. I have tried pickling the data but I must admit I'm not sure what I'm doing.
Can any of you guys help? Are there any numpy/scipy modules I can use?
Cheers
So I've recently moved away from using matlab to use scientific python using predominantly pylab, numpy and scipy. I am however having difficultie in saving a mixed data format of the following structure:
# Header 1
# Header 2
x(1) y(1) z(1)
. . .
. . .
. . .
x(N) y(N) z(N)
I can save the header files quite easily using the following:
f=open('myfile.txt','w')
f.write('#Header1\n#Header2)
f.close
When I more myfile.txt I get
#Header1
#Header2
The difficultie I'm having is storing the array below the header. The x,y,z data is stored as a numpy.ndarray called XYZ. I have tried pickling the data but I must admit I'm not sure what I'm doing.
Can any of you guys help? Are there any numpy/scipy modules I can use?
Cheers