<br><br>On Friday, September 16, 2011, Benjamin Landenberger &lt;<a href="mailto:benjamin.landenberger@imtek.uni-freiburg.de">benjamin.landenberger@imtek.uni-freiburg.de</a>&gt; wrote:<br>&gt; Hello list!<br>&gt;<br>&gt; I have an array *mask* of shape (a, b) and another array *intensities*<br>
&gt; of shape (N, a, b), where the values in *mask* range from 0 to N-1. It<br>&gt; is somehow similar to label arrays in scipy.ndimage.<br>&gt;<br>&gt; Now I want to pick those entries from the first dimension of<br>&gt; *intensities* which are given by *mask*. The returned array shall again<br>
&gt; wave shape (a, b).<br>&gt;<br>&gt; Can this be done with fancy indexing?<br>&gt;<br>&gt; Thank you,<br>&gt;<br>&gt; Ben<br>&gt;<br><br>Try intensities[mask, xrange(a), xrange(b)].<br><br>Untested, but it would work for 1d, haven&#39;t tried for 2d.<br>
<br>Ben Root<br>