Skip to content

[main] Fix quadtree leaf boundaries to match cuSpatial's clamped scale - #87

Open
Tobiaspk wants to merge 1 commit into
mainfrom
bugfix/quadtree-scale-clamp
Open

[main] Fix quadtree leaf boundaries to match cuSpatial's clamped scale#87
Tobiaspk wants to merge 1 commit into
mainfrom
bugfix/quadtree-scale-clamp

Conversation

@Tobiaspk

@Tobiaspk Tobiaspk commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

get_quadrant_bounds() built leaf polygons assuming scale=1, but cuSpatial silently clamps scale higher once max_depth hits its cap of 15, so on datasets with large coordinate values (happened in a CosMx dataset) the tile boundaries stopped matching the tree cuSpatial actually built, dropping ~50% of points from every tile and crashing bincount on an all -1 label tensor.

Fix: compute scale from cuSpatial's own min-scale formula so it's never undershot, and pass the real (scale, max_depth) into get_quadrant_bounds.

This fix worked for me on the CosMx pancreas dataset that crashed: 0/64,960,205 tx and 0/47,488 bd points unmatched, no appropriate warning.

get_quadtree_kwargs() computed scale without checking cuSpatial's own
minimum-scale requirement, which cuSpatial silently clamps up to and
only reports via a UserWarning. get_quadrant_bounds() then computed
each leaf's polygon using the pre-clamp scale, so tile boundaries no
longer matched the tree cuSpatial actually built. On the CosMx
pancreas dataset this dropped ~50% of transcript points from every
tile on the initial join, cascading into an all -1 label tensor and
a bincount crash.

Compute scale directly from cuSpatial's min-scale formula so it's
never undershot, and pass the real (scale, max_depth) into
get_quadrant_bounds so leaf polygons match the actual tree.
@Tobiaspk Tobiaspk changed the title Fix quadtree leaf boundaries to match cuSpatial's clamped scale [main] Fix quadtree leaf boundaries to match cuSpatial's clamped scale Sep 3, 2026
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.

1 participant