title: Fourier smoothing of data set
body: <p>I am following <a href="http://galassi.org/mark/course-2006/fourier-smooth.py" rel="noreferrer">this link</a> to do a smoothing of my data set.
  The technique is based on the principle of removing the higher order terms of the Fourier Transform of the signal, and so obtaining a smoothed function.
  This is part of my code:</p>
  
  <pre><code>N = len(y)
  
  y = y.astype(float)               # fix issue, see below
  yfft = fft(y, N)
  
  yfft[31:] = 0.0                   # set higher harmonics to zero
  y_smooth = fft(yfft, N)
  
  ax.errorbar(phase, y, yerr = err, fmt='b.', capsize=0, elinewidth=1.0)
  ax.plot(phase, y_smooth/30, color='black') #arbitrary normalization, see below
  </code></pre>
  
  <p>However some things do not work properly.
  Indeed, you can check the resulting plot :
  <img src="https://i.stack.imgur.com/wr39S.png" alt="enter image description here">
  The blue points are my data, while the black line should be the smoothed curve.</p>
  
  <p>First of all I had to convert my array of data <code>y</code> by following <a href="https://stackoverflow.com/a/12308336/2107030">this discussion</a>.</p>
  
  <p>Second, I just normalized arbitrarily to compare the curve with data, since I don't know why the original curve had values much higher than the data points.</p>
  
  <p>Most importantly, the curve is like "specular" to the data point, and I don't know why this happens.
  It would be great to have some advices especially to the third point, and more generally how to optimize the smoothing with this technique for my particular data set shape.</p>