In MATALAB I can write easily:
ind = find(X, k, 'last')
that returns at most the last k indices corresponding to the nonzero entries of X.
Numpy has the numpy.nonzero function just for the MATALAB find(X), the one parameter version.
Which is numpythonic way to translate find with 3 arguments?
MatlabtoR).numpyfind returns atuple- one array for each dimension. Do the normal indexing on this tuple.