Skip to content

feat: add asymmetric split gaussian shape - #97

Merged
lpatiny merged 4 commits into
mainfrom
split-gaussian
Jul 28, 2026
Merged

feat: add asymmetric split gaussian shape#97
lpatiny merged 4 commits into
mainfrom
split-gaussian

Conversation

@lpatiny

@lpatiny lpatiny commented Jul 22, 2026

Copy link
Copy Markdown
Member

Adds SplitGaussian, an asymmetric peak made of two gaussian halves sharing the apex — the lower-x half (x ≤ 0) uses fwhmLow, the higher-x half (x > 0) uses fwhmHigh. Left/right would be ambiguous in NMR, where the axis runs the other way.

Equal halves reduce to a plain Gaussian, and fwhm is the true full width at half maximum of the composite peak, the crossings being at -fwhmLow / 2 and fwhmHigh / 2. Ships the analytical derivative, area/height helpers, getShape1D wiring, and tests.

lpatiny added 3 commits July 22, 2026 15:58
`SplitGaussian` models an asymmetric peak as two gaussian halves sharing the apex, each with its own width (`fwhmLeft` / `fwhmRight`). Includes the analytical derivative, area/height helpers, registry wiring (`getShape1D`), and tests.
@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.75000% with 7 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@7ba02fd). Learn more about missing BASE report.
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/shapes/1d/splitGaussian/SplitGaussian.ts 94.44% 6 Missing ⚠️
src/index.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main      #97   +/-   ##
=======================================
  Coverage        ?   96.13%           
=======================================
  Files           ?       24           
  Lines           ?     1088           
  Branches        ?      242           
=======================================
  Hits            ?     1046           
  Misses          ?       41           
  Partials        ?        1           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

`(fwhmLow + fwhmHigh) / 2` is not an aggregate of the two halves, it is the
peak's full width at half maximum: the half-maximum crossings sit at
`-fwhmLow / 2` and `fwhmHigh / 2`. `fwhmToWidth` is exact in the same way, the
width it returns for that fwhm being `σlow + σhigh`; the only caveat is that a
single width cannot be mapped back to the two halves. `getSplitGaussianData`
also listed an `fwhm` shape parameter, which does not exist.

The tests now pin the crossings the fwhm is defined from, the halves each
derivative belongs to, the apex, the default widths, the `length` option, and
that equal halves reproduce `getGaussianData` exactly.

Assisted-By: Claude Opus 5
@lpatiny
lpatiny merged commit 3d0b6f7 into main Jul 28, 2026
10 checks passed
@lpatiny
lpatiny deleted the split-gaussian branch July 28, 2026 08:10
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