title: Total size of array must be unchanged
body: <p>I am using a Python module called emcee to sample a distribution. I need to pass a (37,100) (which I have named Ntrig and Nsamp, respectively) array called <code>events</code> to the below function. </p>
  
  <pre><code>def mp(SNR2, *events):
      events = np.asarray(events).reshape((Ntrig,Nsamp))
      bessel = special.iv(0,np.sqrt(x*SNR2(event)))
      exp = np.exp(-0.5*(x+SNR2(event)))
      I = integrate.quad(lambda x: exp*bessel,0,SNRth**2)[0]
      return np.asarray([np.array[I for event in events[i]] for i in range(len(events))]).reshape(events.shape)
  </code></pre>
  
  <p>I keep getting the error:</p>
  
  <pre><code>ValueError: total size of new array must be unchanged
  </code></pre>
  
  <p>As I understand, <code>*events</code> will break up the <code>events</code> array into 37*100 separate arguments. Shouldn't the next line where I reshape the array just put it back into a 37 by 100 array?</p>
  
  <p>P.S. before you ask why I even bother breaking up <code>events</code> into separate arguments--the module needs this to work, it can't take an array.</p>
  
  <p>Full Traceback error:</p>
  
  <pre><code>ValueError                                Traceback (most recent call last)
  &lt;ipython-input-17-c8e815326a69&gt; in &lt;module&gt;()
  ----&gt; 1 mp(SNR2,events)
  
  &lt;ipython-input-16-9f73f234c628&gt; in mp(SNR2, *events)
        5 def mp(SNR2, *events):
        6     events = np.asarray(events).reshape((Ntrig,Nsamp))
  ----&gt; 7     return np.asarray([np.array([integrate.quad(lambda x: np.exp(-0.5*(x+SNR2(event)))*special.iv(0,np.sqrt(x*SNR2(event))),0,SNRth**2)[0] for event in events[i]]) for i in range(len(events))]).reshape(events.shape)
        8 #    return integrate.quad(lambda x: 0.5*np.exp(-0.5*(x+SNR2(event)))*special.iv(0,np.sqrt(x*SNR2(event))),0,SNRth**2)[0]
        9 def pp(SNR2, *events):
  
  /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/integrate/quadpack.pyc in quad(func, a, b, args, full_output, epsabs, epsrel, limit, points, weight, wvar, wopts, maxp1, limlst)
      279         args = (args,)
      280     if (weight is None):
  --&gt; 281         retval = _quad(func,a,b,args,full_output,epsabs,epsrel,limit,points)
      282     else:
      283         retval = _quad_weight(func,a,b,args,full_output,epsabs,epsrel,limlst,limit,maxp1,weight,wvar,wopts)
  
  /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/integrate/quadpack.pyc in _quad(func, a, b, args, full_output, epsabs, epsrel, limit, points)
      343     if points is None:
      344         if infbounds == 0:
  --&gt; 345             return _quadpack._qagse(func,a,b,args,full_output,epsabs,epsrel,limit)
      346         else:
      347             return _quadpack._qagie(func,bound,infbounds,args,full_output,epsabs,epsrel,limit)
  
  &lt;ipython-input-16-9f73f234c628&gt; in &lt;lambda&gt;(x)
        5 def mp(SNR2, *events):
        6     events = np.asarray(events).reshape((Ntrig,Nsamp))
  ----&gt; 7     return np.asarray([np.array([integrate.quad(lambda x: np.exp(-0.5*(x+SNR2(event)))*special.iv(0,np.sqrt(x*SNR2(event))),0,SNRth**2)[0] for event in events[i]]) for i in range(len(events))]).reshape(events.shape)
        8 #    return integrate.quad(lambda x: 0.5*np.exp(-0.5*(x+SNR2(event)))*special.iv(0,np.sqrt(x*SNR2(event))),0,SNRth**2)[0]
        9 def pp(SNR2, *events):
  
  &lt;ipython-input-16-9f73f234c628&gt; in SNR2(*events)
        1 def SNR2(*events):
  ----&gt; 2     events = np.asarray(events).reshape((Ntrig,Nsamp))
        3     C = 5*np.pi**(-1.33333)*events**(1.66667)/(96*d**2)
        4     return C*integrate.quad(lambda f: f**(-2.3333)/S(f), 20, 1500, limit=1000)[0]
        5 def mp(SNR2, *events):
  
  ValueError: total size of new array must be unchanged
  </code></pre>