Skip to content
New issue

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

Faster version aggregate() method available #744

Open
LucaMarconato opened this issue Oct 31, 2024 · 2 comments
Open

Faster version aggregate() method available #744

LucaMarconato opened this issue Oct 31, 2024 · 2 comments

Comments

@LucaMarconato
Copy link
Member

LucaMarconato commented Oct 31, 2024

While extending SOPA for Visium HD data, @quentinblampey encountered a performance bottleneck with aggregate() that he could improve using pure geopandas code. Since we use geopandas internally, this could be a bug of spatialdata that may be easy to fix.

Here is the SOPA code https://github.com/gustaveroussy/sopa/blob/master/sopa/segmentation/aggregation.py#L485.

@berombau
Copy link
Contributor

berombau commented Nov 6, 2024

See Harpy aggregate implementation as mentioned by @ArneDefauw in #677.

@ArneDefauw
Copy link
Contributor

ArneDefauw commented Nov 6, 2024

See Harpy aggregate implementation as mentioned by @ArneDefauw in #677.

Just a side note, https://github.com/saeyslab/harpy/blob/6b80d01baa11c0ee9ecdfb48d5b0d72be305cb2e/src/sparrow/table/_allocation_intensity.py#L22 which uses https://github.com/saeyslab/harpy/blob/6b80d01baa11c0ee9ecdfb48d5b0d72be305cb2e/src/sparrow/utils/_aggregate.py#L16, which is more general, provides support for aggregation between labels layer and image layers, similar to xr_spatial.zonal_stats, but faster, and with support for custom aggregations https://github.com/saeyslab/harpy/blob/6b80d01baa11c0ee9ecdfb48d5b0d72be305cb2e/src/sparrow/utils/_aggregate.py#L251

I think https://github.com/gustaveroussy/sopa/blob/f1f5a99ee7f5a9489e511241a3a62bb520ec9860/sopa/segmentation/aggregation.py#L485 , focuses on aggregation between shapes layers and bins

@berombau berombau moved this to 🕠 Posponed in Basel Hackathon Nov 2024 Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🕠 Posponed
Development

No branches or pull requests

3 participants