[Numpy-discussion] detecting point out of bounds...
fred
fredmfp at gmail.com
Wed Jun 17 18:32:57 EDT 2009
Hi all,
Let's say I have an array (n,3) ie x, y, v, in each row.
How can I count the number of points (x,y) that are out of bounds (xmin,
xmax) (ymin, ymax)?
The following is obviously wrong:
n = (data[:, 0]<xmin).nonzero()[0].size + \
(data[:, 0]>xmax).nonzero()[0].size + \
(data[:, 1]<ymin).nonzero()[0].size + \
(data[:, 1]>ymax).nonzero()[0].size
and I don't want to use a loop to count the number of bad points,
of course.
Any clue?
TIA.
Cheers,
--
Fred
More information about the NumPy-Discussion
mailing list