Skip to content

feat: improve 2D FT spectrum rendering speed#3927

Merged
hamed-musallam merged 7 commits intomainfrom
reduce-number-of-points-big-2d
Feb 26, 2026
Merged

feat: improve 2D FT spectrum rendering speed#3927
hamed-musallam merged 7 commits intomainfrom
reduce-number-of-points-big-2d

Conversation

@hamed-musallam
Copy link
Member

@hamed-musallam hamed-musallam commented Jan 28, 2026

Implement a new algorithm to reduce 2D FT points to 512 before plotting the contours

@hamed-musallam hamed-musallam linked an issue Jan 28, 2026 that may be closed by this pull request
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 28, 2026

Deploying nmrium with  Cloudflare Pages  Cloudflare Pages

Latest commit: 52965de
Status: ✅  Deploy successful!
Preview URL: https://be652177.nmrium.pages.dev
Branch Preview URL: https://reduce-number-of-points-big.nmrium.pages.dev

View logs

@jobo322
Copy link
Member

jobo322 commented Jan 30, 2026

I still feel too slow the contour generation. Looks the matrix used is still bigger than 1K x 1K

It is a JCAMP file with a 2K × 1K size, and the difference in speed is noticeable.
Cyclosporine_2kx1k.dx.zip

@hamed-musallam
Copy link
Member Author

I still feel too slow the contour generation. Looks the matrix used is still bigger than 1K x 1K

It is a JCAMP file with a 2K × 1K size, and the difference in speed is noticeable. Cyclosporine_2kx1k.dx.zip

@jobo322

Hello Alejandro, the reduction works well, but the issue is with the speed, where the reduction function is called each time we zoom or change contour options.

Original matrix {y: 1024, x: 2048}
Reduced matrix {y: 1024, x: 1024}

@hamed-musallam hamed-musallam force-pushed the reduce-number-of-points-big-2d branch from 554eea0 to 663460a Compare February 20, 2026 07:51
As a first step toward cleaner separation, contour options
are temporarily stored in `view.zoom.levels` instead of on the spectrum
object. This is not the final structure,  a dedicated `view.contours`
object keyed by spectrum id will replace this in a follow-up.
Copy link
Member

@lpatiny lpatiny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While it is slower after zooming it is much faster to change the contour levels.
We can merge this PR for me if the code is ok.

@hamed-musallam hamed-musallam changed the title feat: reduce oversized spectra to 1024 points feat: improve 2D FT spectrum rendering speed Feb 26, 2026
@hamed-musallam hamed-musallam merged commit 54426e2 into main Feb 26, 2026
12 checks passed
@hamed-musallam hamed-musallam deleted the reduce-number-of-points-big-2d branch February 26, 2026 15:33
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.

Reduce number of points if 2D is too big

3 participants