[Numpy-discussion] "Match" two arrays

Shailendra shailendra.vikas@gmail....
Wed Mar 31 22:24:54 CDT 2010


Hi All,
I want to make a function which should be like this
<code>
cordinates1=(x1,y1) # x1 and y1 are x-cord and y-cord of a large
number of points
cordinates2=(x2,y2) # similar to condinates1
indices1,indices2= match_cordinates(cordinates1,cordinates2)
<code>
(x1[indices1],y1[indices1]) "matches" (x2[indices2],y2[indices2])

where definition of "match" is such that :
If A is closest point to B and distance between A and B is less that
delta than it is a "match".
If A is closest point to B and distance between A and B is more that
delta than there is no match.
Every point has either 1 "match"(closest point) or none

Also, the size of the cordinates1 and cordinates2 are quite large and
"outer" should not be used. I can think of only C style code to
achieve this. Can any one suggest pythonic way of doing this?

Thanks,
Shailendra


More information about the NumPy-Discussion mailing list