title: Amplitude from scipy.fft
body: <p>Why is the amplitude I compute far, far away from original after fast Fourier transform (FFT)?</p>
  
  <p>I have a signal with 1024 points and sampling frequency of 1/120000. I apply the fast Fourier transform in Python with scipy.fftpack. I normalize the calculated magnitude by number of bins and multiply by 2 as I plot only positive values.</p>
  
  <p>As my initial signal amplitude is around 64 dB, I get very <strong>low</strong> amplitude values less then 1.</p>
  
  <p>Please see my code.</p>
  
  <pre><code>Signal = well.ReadWellData(SignalNDB)
  y, x = Signal.GetData(numpy=np)
  N = y.size      # Number of sample points 1024 ...
  T = 1/120000    # sampling frequency (sec)
  x = np.linspace(0.0, N*T, N)
  
  yf = abs(fft(y)) # Perform fft returning Magnitude
  xf = np.linspace(0.0, 1.0/(2.0*T), N//2) # Calculatel frequency bins
  
  freqs = fftfreq(N, T)    
  
  ax1=plt.subplot(211) 
  ax1.plot(x,y)
  plt.grid()
  ax2=plt.subplot(212) 
  yf2 = 2/N * np.abs(yf[0:N//2]); # Normalize Magnitude by number of bins and multiply by 2
  ax2.semilogy(xf, yf2) # freq vs ampl - positive only freq    
  plt.grid()    
  ax1.set_title(["check"]) 
  #ax2.set_xlim([0,4000])
  
  plt.show()
  </code></pre>
  
  <p>Please see my plot:</p>
  
  <p><img src="https://i.stack.imgur.com/2TtGf.png" alt="My plot"></p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Finally my signal Amplitude after fft is exactly what I expected. What I did.</p>
  
  <p>First I did fft for signal in mV. Then I converted the results to dB as per the formula: 20*log10(mV)+60; where 60 represents 1 mV proveded by the tool manufacturer.Therefore dB values presented on a linear scale format @ the bottom plot rather than on the log format.</p>
  
  <p>Please see the resulting plot below.
  <a href="https://i.stack.imgur.com/pUxuJ.png" rel="nofollow noreferrer">Results</a></p>