problem with fft periodogram

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • aitor69gonzalez@gmail.com

    #1

    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
    advance.
    I present first the python script and second my data.
    ###### usage ############
    python <script_name<da ta_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_arr ay(f)
    minutes=tempdat a[:,0]
    wolfer=tempdata[:,1]
    # plot data
    gplt.plot(minut es,wolfer,'titl e "Meas" with linespoints')
    gplt.xtitle('Mi nutes')
    gplt.ytitle('Wo lfer number')
    gplt.grid("off" )
    Y=fft(wolfer)
    n=len(Y)
    power = abs(Y[1:(n/2)])**2
    nyquist=1./2
    print nyquist
    freq=array(rang e(n/2))/(n/2.0)*nyquist
    period=1./freq
    # plot period
    gplt.plot(perio d[1:len(period)], power,'title "Simul" with
    linespoints')
    gplt.xaxis((50, 400))
    gplt.xtitle('Pe riod [minutes]')
    gplt.ytitle('|F FT|**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
    ############### ##

  • Travis E. Oliphant

    #2
    Re: problem with fft periodogram

    aitor69gonzalez @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
    advance.
    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_minut es = period * (minutes[1] - minutes[0])

    Then, plot period_in_minut es versus power. I see a peak around 180
    minutes in your data.



    -Travis

    Comment

    Working...