Hi Andrea, 2008/5/23 "Andrea Gavana" <[EMAIL PROTECTED]>: > And so on. The probelm with this approach is that I lose the original > indices for which I want all the inequality tests to succeed:
To have the original indices you just need to re-index your indices, as it were idx = flatnonzero(xCent >= xMin) idx = idx[flatnonzero(xCent[idx] <= xMax)] idx = idx[flatnonzero(yCent[idx] >= yMin)] idx = idx[flatnonzero(yCent[idx] <= yMax)] ... (I haven't tested this code, apologies for bugs) However, there is a performance penalty for doing all this re-indexing (I once fell afoul of this), and if these conditions "mostly" evaluate to True you can often be better off with one of the solutions already suggested. Regards, Peter _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion