Solvent subtraction

Load a sample spectrum and a solvent (reference) spectrum saved from Igor Pro, choose a method, and the page removes the solvent Raman bands from the sample. The Taylor-expansion and shift-and-broadening methods also correct small shifts and width changes of the solvent bands, which leave derivative-shaped residues after a plain scaled subtraction. Methods and equations are at the bottom.

Waves

Sample

Solvent (reference)

Method

Terms

Result

Drag across a plot to zoom in x, double-click to zoom out, hover to read values.

Fitted parameters

Download the result

.ibw: the result wave with the sample's x scaling; the method and fitted parameters are in its wave note. .itx: the result, the solvent fit, the fitted baseline and, if the x axis came from an x wave, the x values; drag it onto Igor or use Data ▸ Load Waves. .txt: x, sample, solvent fit, baseline and result in columns. Points outside the solvent's x range are NaN.

Compare methods

Runs every method with the fit regions and options above. Click a row to use that method.

Methods and equations

S(x) is the sample spectrum, R(x) the solvent reference interpolated onto the sample's x axis (natural cubic spline), x the Raman shift. B(x) = b0 + b1t + b2t² + b3t³ is the optional baseline, a polynomial in t = (x − xc)/w with xc and w the centre and half-width of the fit regions. Fits use only the points inside the fit regions and outside the excluded ranges (mask the solute bands, roughly ±25 cm⁻¹ around each). The result is D(x) = S(x) − M(x), with M the fitted solvent contribution; the baseline is subtracted too only if that box is ticked.

  1. Least-squares scale factor

    mina, b Σi ∈ fit [Si − aRi − B(xi)]²,  M = aR

    Linear least squares by QR. The ± values on this page are standard errors from the fit covariance s²(JᵀJ)⁻¹ with s² = RSS/(N − p). Neighbouring pixels are often correlated and the model is never exact, so treat them as lower bounds.

  2. Peak area ratio

    a = Σregions ∫ [S − ℓS] dx  /  Σregions ∫ [R − ℓR] dx

    ℓ is the straight line through the first and last three points of each region (averaged), so each region should hold one isolated solvent band with a little baseline on both sides. The table also lists the ratio of each region on its own; they should agree.

  3. Minimum roughness

    a = argmin Σ [Δk(S − aR)]² = Σ ΔkS ΔkR / Σ (ΔkR)²,  Δyi = yi+1 − yi,  k = 1 or 2

    Broad solute bands and backgrounds hardly change the point-to-point differences; the narrow solvent bands dominate them. The scale that leaves the smoothest result removes the solvent, without fit regions free of solute. Works best when the solute bands are broader than the solvent bands.

  4. Minimum total variation

    a = argmin Σ |Δ(S − aR)| = weighted median of ΔSi/ΔRi with weights |ΔRi|

    The L1 version of minimum roughness: less sensitive to noise spikes and to strong solute bands. The weighted median is the exact minimum.

  5. Taylor expansion (linear)

    ∫ p(s) R(x − s) ds = R − μ1R′ + (μ2/2) R″ − (μ3/6) R‴ + …,  μn = ∫ sn p(s) ds
    S ≈ a0R + a1R′ + a2R″ + a3R‴ + B,  M = a0R + a1R′ + a2R″ + a3R‴
    δ = μ1 = −a1/a0,  σ² = 2a2/a0 − δ²,  κ3 = −6a3/a0 − 3δσ² − δ³,  FWHM = 2√(2 ln 2) σ ≈ 2.355 σ
    R′ ≈ [R(x+h) − R(x−h)]/2h,  R″ ≈ [R(x+2h) − 2R(x) + R(x−2h)]/4h²,  R‴ ≈ [R(x+3h) − 3R(x+h) + 3R(x−h) − R(x−3h)]/8h³  (np.gradient)
    R″ ≈ [R(x+h′) − 2R(x) + R(x−h′)]/h′²,  R‴ ≈ [R(x+2h′) − 2R(x+h′) + 2R(x−h′) − R(x−2h′)]/2h′³,  h′ = h/2  (fine)

    A small shift δ and a symmetric broadening of any shape (variance σ²) of the solvent bands, expanded to second or third order, is linear in the coefficients ak: one least-squares fit, no starting values. The subtracted terms a1R′ and a2R″ are exactly the dispersive, derivative-shaped solvent residues that a shift or width change leaves behind (for example in transient pump-on − pump-off FSRS spectra). σ² < 0 means the solvent bands are narrower in the sample than in the reference, which the Taylor form handles and a convolution cannot. κ3 measures asymmetry. By default the derivatives are central differences at the reference's point spacing h, applied once, twice and three times (as np.gradient does). The "fine" stencils at h/2 are less biased on narrow bands but pass more of the reference's noise into R″; noise in a fitted column biases its coefficient toward zero (regression dilution), so with a noisy reference a2 and the width come out low. Use fine with a clean or denoised reference. The expansion holds while δ and σ are small compared with the solvent band widths. "Iterate" removes that limit: it replaces R by the reference shifted by the fitted δ and convolved with a Gaussian of the fitted variance σ², R → [R ⊗ Gσ](x − δ), and refits until the new a1 and a2 terms vanish (Gauss–Newton steps). It converges to the exact shift + Gaussian broadening result; a net narrowing stays in the a2R″ term, since a convolution cannot sharpen. Smoothing the solvent helps when its noise is amplified by R″ and R‴.

  6. Shift and broadening (nonlinear, exact)

    M(x) = a [R ⊗ V](x − δ − ε(x − xc)),  V = Gaussian(FWHM wG) ⊗ Lorentzian(FWHM wL)
    ℱ[R ⊗ V](f) = ℱ[R](f) exp(−2π²σ²f² − 2πγ|f|),  σ = wG/2.355,  γ = wL/2

    The reference is resampled on a uniform grid at half its point spacing, padded, broadened by FFT and read at the shifted positions by cubic interpolation, so shifts of any size are exact. For each trial δ, ε, wG, wL the linear parameters a and B come from least squares (variable projection); the nonlinear ones from a grid search over the shift and the widths followed by Nelder–Mead. A convolution can only broaden: wG, wL ≥ 0. Widths add as √(w² + wG²) for Gaussian and w + wL for Lorentzian broadening. ε is a stretch of the x axis (a calibration error that grows across the window): the shift is δ + ε(x − xc), and the table gives it at both ends of the fit regions.

  7. Fit on differences

    min Σ [Δk(S − M − B)]²,  k = 1 or 2

    An option for the least-squares, Taylor and shift-and-broadening methods. It weights the narrow solvent bands and ignores smooth backgrounds. Baseline terms of degree below k drop out (they have no differences), so the baseline is then only partly determined.

  8. Denoising the reference: HSVD

    x(n) = DFT⁻¹[R](n) ≈ Σk Ak e(i2πνk − γk)n,  Hij = x(i + j),  i < N/4,  i + j ≤ N/2,  H → Ur Sr Vrᴴ

    In the time domain each Lorentzian band is a damped complex exponential, and K of them make the Hankel matrix exactly rank K, while white noise spreads over every rank. Keeping a hard rank r, averaging the anti-diagonals back into a signal, rebuilding its conjugate-symmetric half and transforming back removes most of the reference's noise. A hard rank keeps weak bands whole; soft weights near the noise edge shrink them. The rank errs high by default: 3 × the number of singular values clearly above the noise edge (> 1.5 τ), and never fewer than 40. A rank too low cuts weak bands (Voigt-shaped bands need several ranks each: with a Gaussian instrument width σ = 3 cm⁻¹ the weak cyclohexane bands lose 30–40 % at rank 8), and it shows as dips at the band positions in loaded − denoised. A rank too high costs little: from 20 to 40 the denoised solvent's noise goes from about 1.2 to 1.7 × 10⁻³ (from 3.0) in the notes' simulation, and that adds in quadrature to the sample's own noise. The Check button compares the result at r − 10 and r + 10. The noise edge drawn is τ = σₜ(√m + √n) for the m × n matrix, with σₜ from the decayed end of the signal. The reference is first put on an even grid at its median spacing; if its two ends differ by more than their noise, a straight line through them is taken out before the transform and added back after, so the periodic transform sees no jump. The products with H go through FFTs, and the leading 100 singular triplets come from a randomized range finder with power iterations, once per solvent; any rank up to 80 is then rebuilt in milliseconds. Single noise spikes are undamped exponentials, so the ranks above the bands keep the largest of them: a small rest of the noise stays.

  9. Denoising the reference: Savitzky–Golay

    R̃i = value at i of the least-squares quadratic through the N points around i

    Keep N well below the number of points across a solvent band, or the bands themselves get broadened. Either denoiser is applied to the solvent before every method and before its derivatives are taken.

Files