title: Object Too Deep for Desired Array - scipy.integrate.odeint
body: <p>I've just started with Python yesterday, and I'm getting an error using <code>scipy.integrate.odeint</code>.</p>
  
  <p>I've defined a function</p>
  
  <pre><code>def SIR(x, t, beta, gamma, mu, M):
  </code></pre>
  
  <p>which takes the <code>numpy.array</code> objects <code>x</code>, <code>t</code>, and <code>M</code>; and the scalar floats <code>beta</code>, <code>gamma</code>, and <code>mu</code>. </p>
  
  <p><code>M</code> is <code>(60,60)</code> in size, but I don't think this matters.</p>
  
  <p><code>x</code> and <code>t</code> are both nonsingleton, with <code>x.shape</code> being <code>(180,)</code> and <code>t.shape</code> being <code>(5000,)</code>. I've tried giving them a singleton dimension, such that they have shapes <code>(180,1)</code> and <code>(5000,1)</code> respectively, but I still get the same error :</p>
  
  <pre><code>In [1]: run measles_age.py
  ---------------------------------------------------------------------------
  ValueError                                Traceback (most recent call last)
  /Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/IPython/utils/py3compat.py in execfile(fname, *where)
      173             else:
      174                 filename = fname
  --&gt; 175             __builtin__.execfile(filename, *where)
  
  /Users/qcaudron/Documents/SIR/measles_age.py in &lt;module&gt;()
      111 
      112 
  --&gt; 113         x = integrate.odeint(SIR, x0, t, args=(beta, gamma, mu, M));
      114 
      115 #       plot(t, x);
  
  
  /Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/scipy/integrate/odepack.py in odeint(func, y0, t, args, Dfun, col_deriv, full_output, ml, mu, rtol, atol, tcrit, h0, hmax, hmin, ixpr, mxstep, mxhnil, mxordn, mxords, printmessg)
      141     output = _odepack.odeint(func, y0, t, args, Dfun, col_deriv, ml, mu,
      142                              full_output, rtol, atol, tcrit, h0, hmax, hmin,
  --&gt; 143                              ixpr, mxstep, mxhnil, mxordn, mxords)
      144     if output[-1] &lt; 0:
      145         print _msgs[output[-1]]
  </code></pre>
  
  <p>I get this error even when <code>SIR</code> just returns <code>x</code>, and if I strip all arguments apart from <code>x</code> and <code>t</code> from it :</p>
  
  <pre><code>def SIR(x, t):
      return x;
  </code></pre>
  
  <p>As you can see, the line causing the error is </p>
  
  <pre><code>x = integrate.odeint(SIR, x0, t, args=(beta, gamma, mu, M));
  </code></pre>
  
  <p>EDIT :</p>
  
  <p>I've been asked to add the full code for the <code>SIR</code> method. Because it's relatively long, I've dropped the full .py script in a pastebin :
  <a href="http://pastebin.com/RphJbCHN" rel="nofollow">http://pastebin.com/RphJbCHN</a></p>
  
  <p>Thanks again.</p>