problem with fft periodogram

aitor69gonzalez at gmail.com aitor69gonzalez at gmail.com
Wed Oct 25 04:58:01 EDT 2006


Hello,

I am ploting a fft periodogram of my data using a script (found in
internet: http://linuxgazette.net/115/andreasen.html ) that gave me
good results before. There should be a periodicity of >160 in the data
as can be seen by eye. However, this script now says that there is
periodicity of ~9. Can somebody explain me what's wrong? Thank you in
advance.
I present first the python script and second my data.
###### usage ############
python <script_name> <data_file>
######### PYTHON SCRIPT ###########
from scipy import *
import scipy.io.array_import
from scipy import gplt
from scipy import fftpack
# Read file
f=open(sys.argv[1], 'r')
tempdata = scipy.io.array_import.read_array(f)
minutes=tempdata[:,0]
wolfer=tempdata[:,1]
# plot data
gplt.plot(minutes,wolfer,'title "Meas" with linespoints')
gplt.xtitle('Minutes')
gplt.ytitle('Wolfer number')
gplt.grid("off")
Y=fft(wolfer)
n=len(Y)
power = abs(Y[1:(n/2)])**2
nyquist=1./2
print nyquist
freq=array(range(n/2))/(n/2.0)*nyquist
period=1./freq
# plot period
gplt.plot(period[1:len(period)], power,'title "Simul" with
linespoints')
gplt.xaxis((50,400))
gplt.xtitle('Period [minutes]')
gplt.ytitle('|FFT|**2')
##########################
######## DATA ############
0 48
20 49
40 54
60 49
80 69
100 92
120 98
140 58
160 50
180 66
200 76
220 82
240 119
260 141
280 128
300 107
320 93
340 78
360 74
380 74
400 93
420 109
440 135
460 118
480 90
500 64
520 58
540 56
560 70
580 90
600 115
620 158
640 150
660 96
680 73
700 61
720 55
740 66
760 81
780 116
800 142
820 111
840 102
860 84
880 64
#################




More information about the Python-list mailing list