Re: [Numpy-discussion] Numpy Advanced Indexing Question

2008-07-17 Thread Jack.Cook
Robert, Thanks so much! This is exactly what I needed. - Jack > Ah, okay. It's a bit tricky, though. Yes, you need to use fancy > indexing. Since axis you want to be index fancifully is not the first > one, you have to be more explicit than you might otherwise want. For _

Re: [Numpy-discussion] Numpy Advanced Indexing Question

2008-07-17 Thread Stéfan van der Walt
2008/7/17 Robert Kern <[EMAIL PROTECTED]>: > So the way fancy indexing interacts with slices is a bit tricky, and > this is why we couldn't use the nicer syntax of cube[:,:,idx_k]. All > axes with fancy indices are collected together. Their index arrays are > broadcasted and iterated over. *For eac

Re: [Numpy-discussion] Numpy Advanced Indexing Question

2008-07-17 Thread Robert Kern
On Thu, Jul 17, 2008 at 03:16, Stéfan van der Walt <[EMAIL PROTECTED]> wrote: > Hi Robert > > 2008/7/17 Robert Kern <[EMAIL PROTECTED]>: >> In [42]: smallcube = cube[idx_i,idx_j,idx_k] > > Fantastic -- a good way to warm up the brain-circuit in the morning! > Is there an easy-to-remember rule that

Re: [Numpy-discussion] Numpy Advanced Indexing Question

2008-07-17 Thread Stéfan van der Walt
Hi Robert 2008/7/17 Robert Kern <[EMAIL PROTECTED]>: > In [42]: smallcube = cube[idx_i,idx_j,idx_k] Fantastic -- a good way to warm up the brain-circuit in the morning! Is there an easy-to-remember rule that predicts the output shape of the operation above? I'm trying to imaging how the output w

Re: [Numpy-discussion] Numpy Advanced Indexing Question

2008-07-16 Thread Fernando Perez
On Wed, Jul 16, 2008 at 4:08 PM, Robert Kern <[EMAIL PROTECTED]> wrote: > Ah, okay. It's a bit tricky, though. Yes, you need to use fancy > indexing. Since axis you want to be index fancifully is not the first > one, you have to be more explicit than you might otherwise want. For > example, it wou

Re: [Numpy-discussion] Numpy Advanced Indexing Question

2008-07-16 Thread Robert Kern
On Wed, Jul 16, 2008 at 17:12, <[EMAIL PROTECTED]> wrote: > Robert, > > I can understand how this works if K is a constant time value but in my case > K varies at each location in the two-dimensional slice. In other words, if I > was doing this in a for loop I would do something like this > > fo

Re: [Numpy-discussion] Numpy Advanced Indexing Question

2008-07-16 Thread Jack.Cook
: [Numpy-discussion] Numpy Advanced Indexing Question On Wed, Jul 16, 2008 at 16:45, <[EMAIL PROTECTED]> wrote: > Greetings, > > I have an I,J,K 3D volume of amplitude values at regularly sampled time > intervals. I have an I,J 2D slice which contains a time (K) value at each I, &g

Re: [Numpy-discussion] Numpy Advanced Indexing Question

2008-07-16 Thread Robert Kern
On Wed, Jul 16, 2008 at 16:45, <[EMAIL PROTECTED]> wrote: > Greetings, > > I have an I,J,K 3D volume of amplitude values at regularly sampled time > intervals. I have an I,J 2D slice which contains a time (K) value at each I, > J location. What I would like to do is extract a subvolume at a consta

[Numpy-discussion] Numpy Advanced Indexing Question

2008-07-16 Thread Jack.Cook
Greetings, I have an I,J,K 3D volume of amplitude values at regularly sampled time intervals. I have an I,J 2D slice which contains a time (K) value at each I, J location. What I would like to do is extract a subvolume at a constant +/- K window around the slice. Is there an easy way to do thi