title: Numpy: Index 3d array by z-index array
body: <p>Say I have an array</p>
  
  <pre><code>a = np.zeros((3, 3, 3))
  </code></pre>
  
  <p>and a z-index array</p>
  
  <pre><code>z = np.random.randint(0, 3, (3, 3))
  </code></pre>
  
  <p>say z is</p>
  
  <pre><code>array([[1, 0, 2],
         [2, 2, 1],
         [1, 1, 0]])
  </code></pre>
  
  <p>Now I want to select the values of <code>a</code> with coordinates (starting at top left of <code>z</code> and traversing the array row-wise. Column-wise would be fine too.) (0, 0, <strong>1</strong>), (0, 1, <strong>0</strong>), (0, 2, <strong>2</strong>), ... . The bold values are from the <code>z</code> array. </p>