title: Type Error: 'builtin_function_or_method' object has no attribute '__getitem__'
body: <pre><code>def FindBestGamma(u,DLx,DLy,DLcon,x0,y0,t,sigmax0,sigmay0,varinterval):
      u=5
      g = np.linspace(0.,1.,u)
      gammaPossible = np.array([seq for seq in itertools.product(g, repeat=u-1) if abs(sum(seq) - 1.0) &lt; 1.0e-4])
      i = 0
      lv = []
      while i &lt; len(gammaPossible):
          L = []
          j = 0
          while j &lt; 1000:
              var = np.array(sampler(varinterval).next())
              tmp =LV(DLx[i],DLy[i],DLcon[i],gammaPossible[i],var,x0,y0,t,sigmax0,sigmay0)
              L.append(tmp)
              j = j+1
          lv.append(max(L))
          i = i+1
      # return np.argmax(np.array(lv))#
      gamma = gammaPossible[np.argmax(np.array(lv))]
      return gamma
  
  def forwd(x,y,gamma,var,x0,y0,t,sigmax0,sigmay0):
      [mux1,muy1,sigmax1,sigmay1,rho1,mux2,muy2,sigmax2,sigmay2,rho2,mux3,muy3,sigmax3,sigmay3,rho3,mux4,muy4,sigmax4,sigmay4,rho4] = var
      return gamma[0]*ff(x,y,mux1,muy1,sigmax1,sigmay1,rho1,x0,y0,t,sigmax0,sigmay0) + gamma[1]*ff(x,y,mux2,muy2,sigmax2,sigmay2,rho2,x0,y0,t,sigmax0,sigmay0) + gamma[2]*ff(x,y,mux3,muy3,sigmax3,sigmay3,rho3,x0,y0,t,sigmax0,sigmay0) + gamma[3]*ff(x,y,mux4,muy4,sigmax4,sigmay4,rho4,x0,y0,t,sigmax0,sigmay0)
  </code></pre>
  
  <p>This is a sample of a section from my code. Whenever I try to run the whole code, I get the error:  'builtin_function_or_method' object has no attribute '<strong>getitem</strong>' in my def forwd section. I think it has to do with  the gamma calculation because when I test the code by giving gamma a set array such as <code>gamma=[0.0,0.0,0.25,0.75]</code>, the code works. How do I fix the code to prevent the error in the forwd section?</p>
  
  <pre><code>File "/Users/maryjacketti/Desktop/SOSim/sunkunoil/s4.py", line 71, in integ
      return forwd(x,y,gamma,var,x0new,y0new,t,sigmax0,sigmay0)*LV(DLx,DLy,DLcon,gamma,var,x0,y0,tt,sigmax0,sigmay0)
    File "/Users/maryjacketti/Desktop/SOSim/sunkunoil/s4.py", line 49, in forwd
      return gamma[0]*ff(x,y,mux1,muy1,sigmax1,sigmay1,rho1,x0,y0,t,sigmax0,sigmay0) + gamma[1]*ff(x,y,mux2,muy2,sigmax2,sigmay2,rho2,x0,y0,t,sigmax0,sigmay0) + gamma[2]*ff(x,y,mux3,muy3,sigmax3,sigmay3,rho3,x0,y0,t,sigmax0,sigmay0) + gamma[3]*ff(x,y,mux4,muy4,sigmax4,sigmay4,rho4,x0,y0,t,sigmax0,sigmay0)
  TypeError: 'builtin_function_or_method' object has no attribute '__getitem__'
  </code></pre>
  
  <p>This is the error I get.</p>