title: Why does FFT not have an effect on my smoothed signal?
body: <p>I'm playing with FFT at the moment and I try to get periods from noisy signals by recreating <a href="https://dsp.stackexchange.com/questions/8830/how-do-i-determine-if-a-discrete-signal-is-periodic-or-not">this example</a>. While experimenting, I've noticed that after smoothing a quite noisy signal, the result of <code>fft()</code> is actually the same signal again - which is what I don't understand.</p>
  
  <p>Here is a full example which can be run in an IPython Notebook (You can <a href="https://tmp55.tmpnb.org/user/GEaBx8UfIc7m/tree" rel="nofollow noreferrer">create a notebook here</a> and run the code if you want).</p>
  
  <pre class="lang-py prettyprint-override"><code>%matplotlib inline
  import numpy as np
  import pandas as pd
  import matplotlib.pyplot as plt
  
  figsize = (16,8)
  n = 500
  ls = np.linspace(0,2*np.pi, n)
  
  x_target = np.sin(12*ls) + np.sin(52*ls)
  
  x = np.sin(12*ls) + np.sin(52*ls) + np.random.rand(n) * 3.5
  x = x - np.mean(x)
  
  x_smooth = pd.rolling_mean(pd.DataFrame(x), 14).replace(np.nan, 0.0).as_matrix()
  x_smooth = x_smooth - np.mean(x_smooth)
  
  x_smooth = np.roll(x_smooth, -7)
  
  # Getting shwifty and showing what we've got
  plt.figure(figsize=(16,8))
  plt.scatter(ls, x, s=3, c=[1.0,0.0,0.0,1.0])
  plt.plot(ls, x_target, color=[1.0,0.0,0.0, 0.3])
  plt.plot(ls, x_smooth)
  
  plt.legend(["Target", "Smooth", "Noisy Data"])
  
  # Target
  x_fft = np.abs(np.fft.fft(x_target))
  pd.DataFrame(x_fft).plot(figsize=figsize)
  
  # Looks like it should
  x_fft = np.abs(np.fft.fft(x))
  pd.DataFrame(x_fft).plot(figsize=figsize)
  
  # Plots the same signal?
  x_fft = np.abs(np.fft.fft(x_smooth))
  pd.DataFrame(x_fft).plot(figsize=figsize)
  </code></pre>
  
  <p>Below you find the resulting plots of this script.</p>
  
  <h3>Noisy data with smoothed signal:</h3>
  
  <p><a href="https://i.stack.imgur.com/GJsp4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GJsp4.png" alt="enter image description here"></a></p>
  
  <h3>FFT of the target function</h3>
  
  <p><a href="https://i.stack.imgur.com/KXTW7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KXTW7.png" alt="enter image description here"></a></p>
  
  <h3>FFT of the noisy data</h3>
  
  <p><a href="https://i.stack.imgur.com/eJb0R.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eJb0R.png" alt="enter image description here"></a></p>
  
  <h3>FFT of the smoothed data</h3>
  
  <p><a href="https://i.stack.imgur.com/QsFgv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QsFgv.png" alt="enter image description here"></a></p>
  
  <p>I don't really get why this is the case here. Can somebody explain this to me or am I doing something wrong here?</p>