Multi-Peak Curve Fitting for Spectroscopy Data in SciDAVis

Real spectra are rarely a single clean peak. Raman bands overlap, XPS envelopes hide two oxidation states under one hump, and chromatograms merge shoulders into their neighbors. Deconvolving them means fitting a sum of peak functions and reading the positions, widths, and areas of the components. SciDAVis gives you two honest tools for this: a guided multi-peak quick fit and the full Fit Wizard for mixed or complex models.

What this tutorial does not promise. SciDAVis 2.9.x has no automatic peak-finder and no one-click baseline-subtraction tool, and the Fit Wizard offers no min/max bounds on parameters. Every technique below works within those real limits — we will not describe buttons that do not exist.

Step 1 — Prepare the spectrum: baseline first

A drifting baseline corrupts every peak parameter, especially areas. Handle it before or during the fit:

  • Quick route: every built-in peak function in SciDAVis carries a y0 offset parameter, so a flat baseline is absorbed automatically during the fit.
  • Better route: if the baseline slopes or curves, fit it together with the peaks in the Fit Wizard — e.g. a sum of a linear term plus your peaks — rather than trying to subtract it by hand beforehand. Subtracting an imperfect baseline by eye and then fitting the residue is the most common source of biased areas.
  • Sanity check: zoom into peak-free regions of the spectrum. If the fitted baseline misses them visibly, the model is wrong — add a slope term or restrict the fit range before trusting any area.

Step 2 — Pick the right peak model

The two workhorse line shapes, exactly as defined in the official Handbook:

ModelParametersUse it when…
GaussianA = height, w = width, xc = center, y0 = Y offsetBroadening is dominated by instrumental resolution or Doppler/thermal effects — typical for Raman bands, XRD reflections, and chromatography peaks.
LorentzianA = area, w = width, xc = center, y0 = Y offsetBroadening is dominated by lifetime/pressure (collisional) effects — typical for IR absorption lines and NMR resonances. Note the A here means area, not height.

Rule of thumb: start with Gaussian for condensed-phase vibrational spectra and chromatography, Lorentzian for gas-phase and magnetic-resonance lines. When both broadening mechanisms matter, the rigorous answer is a Voigt profile — which SciDAVis does not ship built-in; approximate it in the Fit Wizard with a custom expression or decide which single shape dominates (see FAQ).

Step 3 — The multi-peak quick fit

For the common case — N peaks of the same shape — SciDAVis has a guided path:

  1. Plot your spectrum and make the plot window active.
  2. Go to Quick Fit → Fit Multipeak → Gaussian (or → Lorentzian).
  3. Enter the number of peaks you expect.
  4. For each peak: click one data point near the peak top on the plot, then press ENTER to validate the choice. These clicks are only initial guesses for the centers — they do not need to be exact.
  5. SciDAVis runs the least-squares fit, writes the results to the log window, draws the fitted curve on the plot, and creates a table storing the fit (find it in the project explorer — it is hidden by default).

This is the fastest route from “overlapping hump” to “two centers and two areas,” and for many routine spectra it is all you need.

Step 4 — Mixed models in the Fit Wizard

When peaks need different shapes — say a Gaussian for one band and a Lorentzian for its neighbor — or you need a baseline term included, open the Fit Wizard (Analysis → Fit Wizard, or Ctrl+Y). Per the Handbook, the wizard works in two stages:

  • Stage 1 — the model: pick functions from the selector (built-in set, your saved functions) and add their expressions, or type your own analytical expression in the bottom half of the dialog. Then list the parameters to fit as a comma-separated list.
  • Stage 2 — the parameters: give an initial guess for every parameter. This is the single most important step: quick-fit commands use default guesses and can fail to converge if they start far from the answer; the wizard lets you seed each center, width, and height from what you see on the plot.
  • Weighting: the second tab offers No weighting (default), Instrumental (uses your Y-error bars — add them to the curve first), Statistical (weights from the square roots of the data), and Arbitrary Dataset (your own weight column). Use Instrumental whenever you have real error bars; it is the statistically correct choice.
  • Output: in the Custom Output tab choose Uniform X Function for a smooth model curve or Same X as Fitting Data for a table of fitted values at your actual X points — the latter is what you want for residual analysis.
Convergence strategy (no parameter bounds available). The wizard lets you set the algorithm, tolerance, and iteration count, but not min/max bounds. Work around this the way spectroscopists actually do: (1) seed centers from the multi-peak click workflow, (2) fit the strong, isolated peaks first, (3) then add the weak/shoulder peaks with the strong ones as starting values, and (4) keep the iteration count generous — a fit that stops early on iterations is not a converged fit.

Step 5 — Judge the fit with residuals

A pretty overlay curve proves nothing. Open the fit table (project explorer), add a column with data − fit at each X, and plot it:

  • Good fit: residuals scatter randomly around zero with no visible structure — the model has captured everything systematic.
  • Wavy or humped residuals: a component is missing or the wrong line shape is in use. Add a peak or switch Gaussian ↔ Lorentzian for the suspect band.
  • Residuals fanning out with intensity: your weighting is wrong — switch to Instrumental weighting with real error bars.
  • One region stubbornly off: restrict the fit range to exclude it, or add a baseline term (Step 1) rather than forcing peaks to absorb the error.

Worked example — two overlapping Raman bands

Imagine a Raman spectrum with a broad envelope around 1,350–1,450 cm−1 that you suspect hides two bands (a common D/G-region situation in carbon materials):

  1. Plot the spectrum; check the baseline in the flat regions on both sides of the envelope. It is roughly flat, so the built-in y0 offset will do.
  2. Quick Fit → Fit Multipeak → Gaussian, number of peaks = 2. Click near each visible shoulder top, ENTER each time.
  3. Read the log window: two centers (xc), widths (w), heights (A). Plot residuals from the hidden fit table — they scatter randomly. Done in under two minutes.
  4. If residuals showed structure, you would switch to the Fit Wizard: same two Gaussians plus a linear baseline term, seeded with the quick-fit results as initial guesses, with Same X as Fitting Data output for a second residual check.

FAQ

How do I know how many peaks to fit?

Start from chemistry, not statistics: how many components does the sample plausibly contain? Then check the residuals — systematic structure after fitting N peaks argues for N+1. Fitting more peaks than the data supports gives beautiful overlays with meaningless, highly correlated parameters.

Gaussian or Lorentzian — how do I choose?

Match the broadening physics (Step 2). If unsure, fit both and compare residuals and parameter uncertainties in the log window — but do not mix shapes without a physical reason, or you are just adding knobs.

Can I constrain a parameter to a range?

SciDAVis 2.9.x does not offer min/max bounds in the Fit Wizard. Control the fit through good initial guesses, staged fitting (strong peaks first), and sensible weighting instead.

Does SciDAVis have a Voigt profile built in?

No. Approximate it with a custom expression in the Fit Wizard, or decide which broadening mechanism dominates and use the corresponding single shape — for most routine work the difference is smaller than the experimental noise.

Next steps

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *