Skip to content

Replace spatial-graph with rstar-python - #335

Merged
JoOkuma merged 4 commits into
royerlab:mainfrom
JoOkuma:feat/rstar-spatial-index
Aug 24, 2026
Merged

Replace spatial-graph with rstar-python#335
JoOkuma merged 4 commits into
royerlab:mainfrom
JoOkuma:feat/rstar-spatial-index

Conversation

@JoOkuma

@JoOkuma JoOkuma commented Aug 21, 2026

Copy link
Copy Markdown
Member

Depends on kephale/rstar-python#4.

Replaces spatial-graph with rstar-python point and bounding-box indexes while preserving inclusive ROI queries, dynamic updates, exact node deletion, and one-dimensional filters. rstar-python is now a core dependency; the spatial extra is removed, and uv is pinned to the upstream PR commit until 0.2.0 is released. ASV installs both backends so it can compare the spatial-graph baseline with this branch.

Tests: uv run pytest src/tracksdata -q (1293 passed, 12 skipped, 1 xfailed); Ruff check/format pass; targeted asv continuous upstream/main HEAD --quick passes.

Use rstar-python's point and bounding-box indexes while preserving inclusive queries, exact node deletion, dynamic updates, and one-dimensional filters. Pin the unreleased 0.2.0 implementation until the upstream bounding-box support is released.
Remove the spatial extra now that spatial indexing is part of the standard graph API. Install both spatial backends in ASV so the previous spatial-graph baseline and the rstar-python branch can be benchmarked in the same continuous run.
Comment thread pyproject.toml Outdated
@JoOkuma

JoOkuma commented Aug 24, 2026

Copy link
Copy Markdown
Member Author

Hi @TeunHuijben and @cmalinmayor , any thoughts?
Kyle suggested using it.

Comment thread asv.conf.json Outdated
@cmalinmayor

Copy link
Copy Markdown
Contributor

I'm in favor of not requiring spatial-graph as long as it it needs to run C++ at build time, since our Windows users are very unhappy. Presumably the benchmarks show similar speed?

@TeunHuijben

Copy link
Copy Markdown
Contributor

@cmalinmayor, @JoOkuma,

I created a PR on funtracks that uses this rstar-python version of tracksdata, and benchmarks show that it is faster across all three platforms. Not sure if the funtracks benchmarks cover everything (might have to go to motile_tracker), but is a good sign!

@cmalinmayor

cmalinmayor commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

It really should only affect the GraphArrayView 🤔 Which I'm not sure we benchmark in funtracks at all. The fact that it's faster in funtracks implies we still have some c-compilation time in our benchmarks.
Update: actually looked... Seems like we probably do construct a GraphArrayView since all the faster things have to do with segmentation! Seems plausible!

@TeunHuijben

Copy link
Copy Markdown
Contributor

Hmm interesting, I'll make a motile_tracker draft PR as well

@JoOkuma

JoOkuma commented Aug 24, 2026

Copy link
Copy Markdown
Member Author

I did see a few speed-ups compared to spatial-graph.
Thank you both for the input. I'll merge this.

@JoOkuma
JoOkuma merged commit e94a9d8 into royerlab:main Aug 24, 2026
7 checks passed
@JoOkuma
JoOkuma deleted the feat/rstar-spatial-index branch August 24, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants