numpy - How to debug a function in Python that only sometimes doesn't work? -


i going nuts because function gives wrong pair of data! have numpy array around 700 points:

np.array =[[  1.00000000e+01  -4.65000000e+02]            [  1.78319153e+01  -4.60252579e+02]           ...] 

and have given point:

point [32.121456577748098, -241.01907826915999] 

and want check in array point or index closest given point.

i use line find nearest point:

 array[spatial.kdtree(array).query(point)[1]] 

which works nice. not work! gives item array not closest. interesting fact when try similar functions or solutions both functions not working @ same time. have no idea why works , not. array , points newly generated in main loop used tcp , udp. how can in general debug it?

thanks!

why don't in numpy?

distance = np.sum((yourlist - yourpoint)**2.)**(1/2.) index = np.argmin(distance) 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -