title: How to fix operands of different shapes?
body: <pre><code>nonlin = flux_2/fit_2 
  
  polyfit_function = np.polyfit(flux_1[i,j,:], nonlin, 3, full=True) 
  print(polyfit_function)
  
  fit=np.polyval(polyfit_function,np.arange(np.min(flux_1),np.max(flux_1)))
  
  plt.plot(flux_1[i,j,:], nonlin,'.')
  plt.plot(np.arange(np.min(flux_1),np.max(flux_1)), polyfit_function)
  plt.show()
  </code></pre>
  
  <p>The error that occurs is in the <code>np.polyval</code> function:</p>
  
  <pre><code>val(p, x)
      679         y = NX.zeros_like(x)
      680     for i in range(len(p)):
  --&gt; 681         y = y * x + p[i]
      682     return y
      683 
  ValueError: operands could not be broadcast together with shapes (24479,) (4,)
  </code></pre>
  
  <p>Thought that the error may have been due to using numpy arrays however converting to python lists didn't help. </p>
  
  <p>Help please :)</p>