title: Calculating Area Under Individual Peaks in Python After FFT
body: <p>I've generated a graph of a FFT, with a number of individual peaks, in Python 2.7.3. </p>
  
  <p><img src="https://i.stack.imgur.com/FXqSV.png" alt="http://imgur.com/O9E0e"></p>
  
  <p>I understand that to calculate the area under the whole graph, I can either sum the values or use trapz, but I'm struggling when trying to restrict these calculations to a single region. For example, I'd like to calculate just the area between 105 and 120Hz, or between 145 and 155Hz.</p>
  
  <p>If it helps, the code to generate this graph is:</p>
  
  <pre><code>x=arange(0,15,0.01)
  
  y=exp(-0.3*x)*exp(x*pi*20j)+exp(-0.9*x)*exp(x*pi*25j)+exp(-0.9*x)*exp(x*pi*15j)
  
  fft(y)
  plot(fft(y))
  xlabel('frequency (Hz)')
  show()
  </code></pre>
  
  <p>I'm sure I'm probably just missing something relatively simple, but as a complete novice of programming I'd appreciate any help you can provide and a brief search of SO didn't provide any answers. Thanks.</p>