Re: [Numpy-discussion] array indexing question

2014-10-14 Thread Nathaniel Smith
For this to work at all you have to know a priori that there are the same number of non-zero entries in each row of your mask. Given that you know that, isn't it just a matter of calling reshape on the second array? On 14 Oct 2014 20:37, "Neal Becker" wrote: > I'm using np.nonzero to construct th

[Numpy-discussion] array indexing question

2014-10-14 Thread Neal Becker
I'm using np.nonzero to construct the tuple: (array([0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2]), array([1, 3, 5, 7, 2, 3, 6, 7, 4, 5, 6, 7])) Now what I want is the 2-D index array: [1,3,5,7, 2,3,6,7, 4,5,6,7] Any ideas? -- -- Those who don't understand recursion are doomed to repeat it __

Re: [Numpy-discussion] array indexing question

2008-11-13 Thread Scott Sinclair
2008/11/14 Catherine Moroney <[EMAIL PROTECTED]>: > I have three arrays, with dimensions: > > A[np] > L[np] > S[np] > > where L and S indicate the line, smp co-ordinates for each of the > "np" rows. > I want to reconstruct the contents of [A] as a 2-dimensional matrix. > > The brain-dead version of

[Numpy-discussion] array indexing question

2008-11-13 Thread Catherine Moroney
Hello, I know that there must be a fast way of solving this problem, but I don't know what it is. I have three arrays, with dimensions: A[np] L[np] S[np] where L and S indicate the line, smp co-ordinates for each of the "np" rows. I want to reconstruct the contents of [A] as a 2-dimensional