Computing FFT with Python NumPy 1.0

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

    #1

    Computing FFT with Python NumPy 1.0

    I recently installed Python 2.5 on Windows and also installed numpy
    1.0. I'd like to compute an FFT on an array of numbers but I can't
    seem to access the FFT function. I'm fairly new to Python (obviously)
    and I can't seem to find documentation to match my distribution of
    numpy and I can't figure out how to access the FFT function.

    Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit
    (Intel)] on win32
    Type "copyright" , "credits" or "license()" for more information.

    IDLE 1.2
    >>from numpy import *
    >>a=array((1,2, 3,2,1,2,3,2,1))
    >>fft(a)
    Traceback (most recent call last):
    File "<pyshell#2 >", line 1, in <module>
    fft(a)
    TypeError: 'module' object is not callable
    >>>
    Help appreciated thanks.

  • Tim Leslie

    #2
    Re: Computing FFT with Python NumPy 1.0

    On 1 Nov 2006 16:04:59 -0800, mcdurr@gmail.co m <mcdurr@gmail.c omwrote:
    I recently installed Python 2.5 on Windows and also installed numpy
    1.0. I'd like to compute an FFT on an array of numbers but I can't
    seem to access the FFT function. I'm fairly new to Python (obviously)
    and I can't seem to find documentation to match my distribution of
    numpy and I can't figure out how to access the FFT function.
    >
    Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit
    (Intel)] on win32
    Type "copyright" , "credits" or "license()" for more information.
    >
    IDLE 1.2
    >from numpy import *
    >a=array((1,2,3 ,2,1,2,3,2,1))
    >fft(a)
    >
    Traceback (most recent call last):
    File "<pyshell#2 >", line 1, in <module>
    fft(a)
    TypeError: 'module' object is not callable
    >>
    >
    Help appreciated thanks.
    The fft routines now live in numpy.fft.
    >>from numpy.fft import fft
    >>from numpy import array
    >>a=array((1,2, 3,2,1,2,3,2,1))
    >>fft(a)
    array([ 17. +0.j , -1.15270364-0.41954982j,
    -3.37938524-2.83564091j, 0.5 +0.8660254j ,
    0.03208889+0.18 198512j, 0.03208889-0.18198512j,
    0.5 -0.8660254j , -3.37938524+2.83 564091j,
    -1.15270364+0.41 954982j])

    Comment

    • Robert Kern

      #3
      Re: Computing FFT with Python NumPy 1.0

      mcdurr@gmail.co m wrote:
      I recently installed Python 2.5 on Windows and also installed numpy
      1.0.
      You will want to ask numpy questions on the numpy mailing list.


      I'd like to compute an FFT on an array of numbers but I can't
      seem to access the FFT function. I'm fairly new to Python (obviously)
      and I can't seem to find documentation to match my distribution of
      numpy and I can't figure out how to access the FFT function.
      >
      Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit
      (Intel)] on win32
      Type "copyright" , "credits" or "license()" for more information.
      >
      IDLE 1.2
      >>>from numpy import *
      >>>a=array((1,2 ,3,2,1,2,3,2,1) )
      >>>fft(a)
      >
      Traceback (most recent call last):
      File "<pyshell#2 >", line 1, in <module>
      fft(a)
      TypeError: 'module' object is not callable
      All of the fft functions are in the numpy.fft module.
      >>from numpy import *
      >>a=array((1,2, 3,2,1,2,3,2,1))
      >>fft.fft(a)
      array([ 1.70000000e+01+ 0.j , -1.15270364e+00-0.41954982j,
      -3.37938524e+00-2.83564091j, 5.00000000e-01+0.8660254j ,
      3.20888862e-02+0.18198512j, 3.20888862e-02-0.18198512j,
      5.00000000e-01-0.8660254j , -3.37938524e+00+ 2.83564091j,
      -1.15270364e+00+ 0.41954982j])

      --
      Robert Kern

      "I have come to believe that the whole world is an enigma, a harmless enigma
      that is made terrible by our own mad attempt to interpret it as though it had
      an underlying truth."
      -- Umberto Eco

      Comment

      Working...