title: Sign flipping Fourier transform Python Numpy Array
body: <p>I have data that is the sign of data in a numpy array:</p>
  
  <pre><code>Data=[-1,1,-1,1,1,1,-1,1,-1,1,...,N]
  </code></pre>
  
  <p>There is an obvious pattern from inspection where every 3rd element is negative:</p>
  
  <pre><code>Pattern=[1,1-1,1,1,-1,1,1,-1...]
  </code></pre>
  
  <p>But there is noise so I cant directly quantify this, so I would like to do a fourier transform to see how strong this spatial repetition is. </p>
  
  <p>I would expect to see a large peak at frequency=N/3 since this pattern seems to repeat every 3 values. </p>
  
  <p>So far I have tried:</p>
  
  <p>For a data of N=401 I have tried:</p>
  
  <pre><code>y=numpy.fft.fft(Data)
  x = np.linspace(0,400,401)
  
  plt.plot(x,y.real) 
  plt.show()
  </code></pre>
  
  <p>but I am getting noise and no clear peaks which I know exist. I have a feeling I am not implementing the fft correctly.</p>