472,333 Members | 1,092 Online

# problem with fft periodogram

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
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
f=open(sys.argv[1], 'r')
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
#################

Oct 25 '06 #1
1 3742
ai*************@gmail.com wrote:
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
The units are wrong on your period axis. Right now you have them in
units of "sample-spacing". So, the plot is telling you that you have a
periodicity of ~9 sample spacings. To get it in unites of minutes you
need to multiply period by the difference in minutes

period_in_minutes = period * (minutes[1] - minutes[0])

Then, plot period_in_minutes versus power. I see a peak around 180

-Travis

Oct 25 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.