I know that there's an easy way to solve this problem, but I'm not sufficiently 
knowledgeable
about numpy indexing to figure it out.

Here is the problem:

Take a 2-d array a, of any size.
Sort it in ascending order using, I presume, argsort.
Step through the sorted array in order, and for each element in the sorted 
array,
retrieve what the corresponding (line, sample) indices in the original array 
are.

For instance:

a = numpy.arange(0, 16).reshape(4,4)
a[0,:] = -1*numpy.arange(0,4)
a[2,:] = -1*numpy.arange(4,8)

asort = numpy.sort(a, axis=None)
for idx in xrange(0, asort.size):
        element = asort[idx]
        !! Find the line and sample location in a that corresponds to the i-th 
element in assort

Thank-you for your help,

Catherine



_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to