Skip to content

fix(ranges): detect range signals in a ROI with noise level measured in global spectrum - #4436

Open
jobo322 wants to merge 10 commits into
mainfrom
fix/range-signals-baseline-noise
Open

jobo322 wants to merge 10 commits into
mainfrom
fix/range-signals-baseline-noise

Conversation

@jobo322

@jobo322 jobo322 commented Nov 11, 2026

Copy link
Copy Markdown
Member

The peak picking cutoff used inside a range was derived from the range itself (3 * median of the ROI). In a narrow range most points belong to the peaks, so the cutoff was close to, or bigger than, the peak height: no peak was picked and the range was left without signals (empty Kind, assignment not editable).

The detection now uses the baseline noise of the whole spectrum (median(|y|) * 8, as autoPeakPicking does) and, when nothing can be detected while the range contains something above that baseline, the point of maximum intensity is reported as a signal of unknown multiplicity. A range that only contains noise stays empty.

Refs: #4435

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Deploying nmrium with  Cloudflare Pages  Cloudflare Pages

Latest commit: a91f64c
Status: ✅  Deploy successful!
Preview URL: https://858b4a4e.nmrium.pages.dev
Branch Preview URL: https://fix-range-signals-baseline-n.nmrium.pages.dev

View logs

@lpatiny

lpatiny commented Nov 11, 2026

Copy link
Copy Markdown
Member

2.zip

This file still does not works seems to me.

image

I also wonder what is this spectrum (median(|y|) * 8

@jobo322

jobo322 commented Nov 11, 2026

Copy link
Copy Markdown
Member Author

This PR is not related with the dominant carbon solvent signal. this PR is tackle that we are taking the noise level calculated directly in the ROI instead of the global noise level that includes the baseline points in the calculation.

@jobo322
jobo322 requested a review from lpatiny November 18, 2026 05:46

@lpatiny lpatiny left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree that using the global noise make sense because indeed if we make the range picking on a signal we will have practically no noise.

Now when we zoom in a peak that does not touch the baseline (like in the following case) the algorithm to calculate if we are over the noise or use Damien's algorithm fails.

I think we need before applying this peaks picking and Damien's algorithm to remove the trapezoid defined by first / last point then we do peak picking, send to Damien's code, then we readd the removed value ...

image

seed = (seed * 1_103_515_245 + 12_345) % 2_147_483_648;
y[i] += ((seed / 2_147_483_648) * 2 - 1) * NOISE;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we use spectrum generator ? Seems always the same code.

This branch has not been deployed

No deployments
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.

2 participants