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

Optimized binning into hex mesh #38

Merged
merged 3 commits into from
Nov 14, 2022

Conversation

danilexn
Copy link
Member

@danilexn danilexn commented Nov 3, 2022

This PR adapts code from matplotlib to mesh into hexagonal bins more efficiently.

With this, it is no longer necessary to compute the pairwise Euclidean distance between spots and bins, since spot coordinates are directly binned into hex coordinates.

E.g., when binning a Seq-scope tile into 7 um hex bins, time is reduced from ~15 min to ~3 min; memory usage is ~10x lower.

@mschilli87
Copy link
Member

LGTM license-wise. 😃
Did not perform any functional test though. 😉

@nukappa
Copy link
Member

nukappa commented Nov 12, 2022

PR looks good, tested it on 10 tiles and memory usage was ~100x lower, speed reduced from ~35min to ~10.

@danilexn before we merge can you pls check the following:

  • Make the optimize_binning default by setting True in the create_mesh function
  • I guess this extends beyond hexagons to circles? Can you pls adapt that part of the function, too?

@danilexn
Copy link
Member Author

PR looks good, tested it on 10 tiles and memory usage was ~100x lower, speed reduced from ~35min to ~10.

@danilexn before we merge can you pls check the following:

  • Make the optimize_binning default by setting True in the create_mesh function

Done, see 329345a

  • I guess this extends beyond hexagons to circles? Can you pls adapt that part of the function, too?

Yes indeed, I am extending it to circle meshing – now testing if outputs are similar to the current approach.

Thanks for the review!

@danilexn
Copy link
Member Author

danilexn commented Nov 13, 2022

PR looks good, tested it on 10 tiles and memory usage was ~100x lower, speed reduced from ~35min to ~10.

@danilexn before we merge can you pls check the following:

  • Make the optimize_binning default by setting True in the create_mesh function
  • I guess this extends beyond hexagons to circles? Can you pls adapt that part of the function, too?

962ae29 implements optimized binning to circle mesh. As well, meshes (for circle and hex cases) should be identical to non-optimized cases, now. I measured similar speedups and memory usage, for circular and hex cases.

@nukappa nukappa merged commit 6bf85ce into rajewsky-lab:master Nov 14, 2022
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