title: using numpy.unravel_index
body: <p>Hi I have a 2x4 array called mi_reshaped.  I used the argmax to find out the indeces of the largest elements in my array.  Now I want to convert these indeces to x,y coordinates.  So I used the numpy.unravel_index.  I get this error:</p>
  
  <pre><code>Traceback (most recent call last):
  File "CAfeb.py", line 273, in &lt;module&gt;
  analyzeCA('full', im)
  File "CAfeb.py", line 80, in analyzeCA
  bg_params = parameterSearch( im, [3, 2], roi, ew, hist_sz, w_data);
  File "CAfeb.py", line 185, in parameterSearch
  ix = np.unravel_index(max_ix, mi_reshaped.shape)#(mi.size)
  File "/usr/lib/pymodules/python2.7/numpy/lib/index_tricks.py", line 64, in unravel_index
  if x &gt; _nx.prod(dims)-1 or x &lt; 0:
  ValueError: The truth value of an array with more than one element isambiguous.   
    a.any() or a.all()
  mi_reshaped=mi.reshape(2,4)
  max_ix = np.argmax(mi_reshaped, axis=1)
  ix = np.unravel_index(max_ix, mi_reshaped.shape)#(mi.size)
  </code></pre>
  
  <p>Thank you</p>