title: Python returns error "Arrays used as indices must be of integer (or boolean) type"
body: <p>I am try to fitting with myself 2d Gaussian. Main goal is extract the parameters of Gaussian. Here my code. </p>
  
  <pre><code>import matplotlib.pyplot as plt
  import numpy as np
  import random
  from scipy.optimize import curve_fit,fmin
  
  def Gauss2(x,y, amplitude, xo, yo, sigma_x, sigma_y, theta, bgr):
        xo = float(xo)
        yo = float(yo)    
        a = (np.cos(theta)**2)/(2*sigma_x**2) + (np.sin(theta)**2)/(2*sigma_y**2)
        b = -(np.sin(2*theta))/(4*sigma_x**2) + (np.sin(2*theta))/(4*sigma_y**2)
        c = (np.sin(theta)**2)/(2*sigma_x**2) + (np.cos(theta)**2)/(2*sigma_y**2)
        g = bgr + amplitude*np.exp( - (a*((x-xo)**2) + 2*b*(x-xo)*(y-yo) 
                          + c*((y-yo)**2)))
        return g
  
  xsz = 40
  ysz = 40
  
  x0=xsz/2
  y0=ysz/2
  
  MInt1=200
  bgr=10
  noise=5
  
  sigma_x = 5.
  sigma_y = 4.
  
  ### create random Gaussian 2d
  x = np.linspace(0, xsz-1, xsz)
  y = np.linspace(0, xsz-1, xsz)
  xx1, yy1 = np.meshgrid(x, y)
  ex1=np.exp(-(((xx1-x0)**2)/(2*sigma_x**2) + ((yy1-y0)**2)/(2*sigma_y**2)))
  z1 = MInt1* random.uniform(0, 1)*noise* ex1
  
  theta=0
  #aa=Gauss2(xx1,yy1, MInt1,x0,y0,sigma_x,sigma_y,theta,bgr)
  
  poptX, pcovX = curve_fit(Gauss2, z1[x,y], p0=[x,y, MInt1,x0,y0,sigma_x,sigma_y,theta,bgr])
  
  img = z1.reshape((xsz,xsz))
  plt.imshow(img); plt.colorbar();plt.show()
  </code></pre>
  
  <p>I getting this message:</p>
  
  <blockquote>
    <p>IndexError: arrays used as indices must be of integer (or boolean) type</p>
  </blockquote>