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" <[email protected]> wrote:
> 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 > > _______________________________________________ > NumPy-Discussion mailing list > [email protected] > http://mail.scipy.org/mailman/listinfo/numpy-discussion >
_______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
