On Wed, Feb 8, 2012 at 6:49 AM, Travis Oliphant <tra...@continuum.io> wrote: > There are also some very nice applications where you can select out of a 3-d > volume a depth-surface defined by indexes like so: > > arr[ i[:,newaxis], j, depth] > > where arr is a 3-d array, i and j are 1-d index arrays: i = > arange(arr.shape[0]) and j = arange(arr.shape[1]), and depth is a 2-d array > of "depths". The selected result will be 2-d.
For those of you new to fancy indexing and broadcasting, have a look at the Advanced NumPy Tutorial slides from SciPy2008: http://mentat.za.net/numpy/numpy_advanced_slides/ It also includes an example like the one Travis mentioned. Regards Stéfan _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion