Home » SciPy FFTpack

SciPy FFTpack

The FFT stands for Fast Fourier Transformation. The Fourier transformation converts the time-domain signal into the frequency domain. It breaks a waveform (a function or signal) into another replacement characterized by sine and cosine. It can convert the periodic time signal whereas the Laplace transform converts both periodic and aperiodic signal.

There is a limitation in the Fourier transformation, it can only convert the stable time signal. SciPy provides the fftpack module, which is used to calculate Fourier transformation.

Fast Fourier Transform

One Dimensional Discrete Fourier Transform

The discrete Fourier transformation (DFT) is the most crucial discrete transform, which is used to perform Fourier analysis in many practical applications.

The FFT of length N sequence x[n] is calculated by fft() function and the inverse transform is calculated using ifft().


[5.5       +0.j         6.69959347-2.82666927j 0.55040653+3.51033344j   0.55040653-3.51033344j 6.69959347+2.82666927j]  

The scipy.fftpack module allows to compute fast Fourier transforms. We can use it for noisy signal because these signals require high computation. An example of the noisy input signal is given below:


The Signal Size is: 1000  

In the above program, we have created a signal with a time step of 0.02 seconds. The statement prints the signal size as we can see in the output. We do not have idea about the signal frequency; we only familiar the sampling time step of the signal sig.

The scipy.fftpack.fftfreq() function will create the sampling frequencies and scipy.fftpack.fft() will compute the fast Fourier transform.


[ -4.36424554+0.00000000e+00j  -0.04699618+2.19694444e+01j    -7.01929898+1.04796659e+01j -17.63704986-1.25717602e+01j    -9.60405228-4.95595106e+02j -11.47597041-1.51768467e+01j............]  

Discrete Cosine Transform

The Discrete Cosine Transform represents data by summation of the cosine function. It transforms a sequence of the real data points into its real spectrum and therefore avoids the problem of the redundancy. DCT is mostly used in the image compressing.

DCT is similar to discrete Fourier transformation (DFT), but it uses only real numbers.

Let’s consider the following example:


[ 64.          -1.55291427 -12.12435565  16.97056275  11.    -5.79555496]  

Usage of DCT

The DCT is used in various fields. These fields are given below:

  • Image Processing- Compression, Scientific Analysis.
  • Audio Processing- Compression (MPEG or Mp3).
  • Scientific Computing- Partial Differential Equation Solvers.

Next TopicSciPy Integrate

You may also like