kdtree radius search not working
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 229
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
When running radius search on my point cloud, I get an error:
> File "D:\repos\scripts\venv\lib\site-packages\pyntcloud\core_class.py", line 590, in get_neighbors
> return r_neighbors(kdtree, r)
> File "D:\repos\scripts\venv\lib\site-packages\pyntcloud\neighbors\r_neighbors.py", line 21, in r_neighbors
> return np.array(kdtree.query_ball_tree(kdtree, r))
>ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (5342,) + inhomogeneous part.`
k-neighbor search works as expected.
**To Reproduce**
My code to reproduce the bug:
`cloud = PyntCloud.from_file(pc_path)`
`kdtree_id = cloud.add_structure("kdtree")`
`r_neighbors = cloud.get_neighbors( r=5, kdtree=kdtree_id)`
**Desktop (please complete the following information):**
- OS: Win 10
- pyntcloud: 0.3.1
- python 3.9
Contributor guide
Research direction
Start in pyntcloud/neighbors/r_neighbors.py at line 21, called by get_neighbors in pyntcloud/core_class.py around line 590. Run the supplied radius-search example against the reported setup and inspect how the variable-length query_ball_tree result is handled; done means radius search completes without the reported ValueError and returns the neighbors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100