[SciPy-user] Help with FFT code

Aaron Williams aaron_lamont_w at yahoo.com
Wed Jun 30 23:47:41 EDT 2004


Hi 

I am a new user of python and scipy. I am trying to write a code that Fast Fourier Transforms 2-D arrays saved as binary FORTRAN files. I would like for my code to also create an output file containing the certain statistics about the imported data set. 
 
First I am having a problem calling my program from the command line. When I run the code with Python shell IDLE nothing happens.
 
Second I was wondering how to create an output file in my code.
 
 Here is an example of my code. 
################################# 
# FFT converter 
#!/usr/bin/python 
from scipy import * 
io.array_import 
#open Fortran Binary array 
x = raw_input("enter in file path, i.e. 'path' else enter 'No'") 
if x == No: 
print "no data file enter end of program" 
else: 
fid=io.fopen(x,'r','n') 
z1=fid.fort_read(256,dtype='f') 
#data array is brought in as 1D array needs to be 2D 
zcl=reshape(z1,(256,256)) 
zcl2=fftpack.fft2(zcl) 
zcl3=fftpack.fftshift(zcl2) 
zcl4=zcl3*conjugate(zlc3) 
#power spectrum 
zcl5=zcl4.real 
#xplt.imagesc(zcl5) 
#xplt.imagesc(zcl) 
#Ask for the name of plot 
q=raw_input("Enter name of transformed File")
xplt.imagesc(log(zcl5)) 
xplt.eps(q) 
s=raw_input("Enter Name of Original")
xplt.imagesc(zcl) 
xplt.eps(s) 

##################################### 

I have been able to enter the italicized parts into the command individually, but this not efficient for as many transforms I need to do.
 
Cheers,


		
---------------------------------
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20040630/e6593561/attachment.html>


More information about the SciPy-User mailing list