We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm not sure if this is a bug or not, but the 'invalid' value is different depending on the query:
>>> import numpy as np >>> a = np.arange(30.0) >>> kdt = KDTree(a) >>> kdt.query(np.arange(5) + 0.5) (array([0.5, 0.5, 0.5, 0.5, 0.5]), array([0, 1, 2, 3, 4], dtype=uint32)) >>> kdt.query(np.arange(50) + 0.5) (array([ 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5, 16.5, 17.5, 18.5, 19.5, 20.5]), array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29], dtype=uint32))
everything okay above.
So if we set distance_upper_bound, then invalid points are np.inf and len(data_pts):
distance_upper_bound
np.inf
len(data_pts)
>>> kdt.query(np.arange(50) + 0.5, distance_upper_bound=10) (array([0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf]), array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], dtype=uint32))
But if we pass np.nan, the invalid point is DBL_MAX and UINT_MAX:
np.nan
DBL_MAX
UINT_MAX
>>> kdt.query(np.array([np.nan])) (array([1.34078079e+154]), array([4294967295], dtype=uint32))
The text was updated successfully, but these errors were encountered:
For reference, SciPy's cKDTree returns (inf, len(data_pts)) for np.nan.
(inf, len(data_pts))
Sorry, something went wrong.
The intention is to be drop-in compatible with SciPy's CKDTree so this is a bug
No branches or pull requests
I'm not sure if this is a bug or not, but the 'invalid' value is different depending on the query:
everything okay above.
So if we set
distance_upper_bound
, then invalid points arenp.inf
andlen(data_pts)
:But if we pass
np.nan
, the invalid point isDBL_MAX
andUINT_MAX
:The text was updated successfully, but these errors were encountered: