Fast Fourier Transform In SciPy

Today’s goal is to obtain a fft() of the interpolated data (the 32000+ sample values of the signal).

Understand the difference between Fourier Transform, Fast Fourier Transform, and Fourier Series.

  • Fourier Transform (wikipedia): expresses a mathematical function of time as a function of frequency, known as the frequency specturn. Inverse Fourier Transform expresses a frequency function in the time domain. Each value of the function is usually expressed as a complex number (magnitude and phase components). “Fourier transform” refers to both the transform operation and to the complex-valued function it produces.
    • Can be simplified to the calculation of a discrete set of complex amplitudes, called Fourier series coefficients.
  • Discrete-Time Fourier Transform
  • Fourier Series (wikipedia): decomposes periodic functions or periodic signals into the sum of a (possibly infinite) set of simple oscillating functions, namely sines and cosines.

What I’m starting off with:

  • originally 60 samples
  • old sampling rate of 24 samples/1 sec
  • length of time for data = 60 frames/24fps = 2.5 seconds
  • interpolation gives 32768 samples = N
  • new sampling rate of 32768/2.5 = 13107.2 samples/second

It looks like the fft assumes that the input data is defined as one period. However, my input data represents 3 periods in length.

In looking around on the SciPy documentation, I saw a section on “Discrete Cosine Transforms” and “Discrete Sine Transforms”.

Discrete Cosine Transform (wikipedia):

A DCT is a Fourier-related transform similar to the discrete Fourier transform (DFT), but using only real numbers. DCTs are equivalent to DFTs of roughly twice the length, operating on real data with even symmetry. There are eight standard DCT variants. The most common is the type-II DCT. Its inverse, the type-III DCT, is known as “the inverse DCT”.

LINKS:

MIGHT BE MY ANSWER: http://stackoverflow.com/questions/4258106/how-to-calculate-a-fourier-series-in-numpy

ALSO: http://www.ehow.com/how_12016938_compute-fourier-series-python.html

Good animated GIF on Fourier Series: http://www.sosmath.com/fourier/fourier2/fourier2.html

Pyopengl, fft python example: http://pyopengl.sourceforge.net/pydoc/numpy.fft.fftpack.html

This is what I’ve been searching for: http://linuxgazette.net/114/andreasen.html

http://linuxgazette.net/115/andreasen.html

Link to a StackOverflow question regarding the above example: http://stackoverflow.com/questions/4451591/recreating-time-series-data-using-fft-results-without-using-ifft

Reference for python instructions, including matplotlib examples and a fft() example: http://www.uncg.edu/phy/hellen/Python_Instructions.html

Advertisements
Tagged , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Advertisements
%d bloggers like this: