Non-Linear Least Squares Fitting
Non‑linear least‑squares (NLLS) fitting is used to model and quantify spectral features by fitting mathematical functions to peaks in a spectrum. Unlike Multiple Linear Least‑Squares (MLLS) fitting, which uses static reference spectra, NLLS fitting uses parameterized models (such as Gaussian functions).
In DigitalMicrograph® software, the NLLS tools allow you to:
- Fit one or more spectral peaks (for example, Gaussian peaks)
- Quantify peak parameters such as amplitude, center, and height
- Apply peak fitting across an entire spectrum image, hence display fitted parameters as 2D maps, enabling spatial mapping of peak shifts and variations
This provides a powerful tool for mapping peak shifts in a spectrum image.
The NLLS Fitting Preferences dialog contains the controls for configuring and performing non‑linear least‑squares fitting.
Configure fit strategy
- Fit multiple items
- Combined – Fits all selected models simultaneously to find the optimal linear combination.
- Sequentially – Fits models one at a time in a defined order.
- Independent – Fits each model independently of the others.
- Defaults – Select the default fit model (The default model is Gaussian).
- Live Display – Controls the output shown in the 1D live fit overlay:
- Total fit
- Residual (misfit) signal
- Individual fits

Define the fit region and models
- Ensure NLLS is selected in the Least‑Squares Fitting palette.
- Use the rectangular ROI tool to select the spectral feature or energy range to be fitted.

- Select the Arrow button and choose a fit model from the NLLS Fit dialog.

- The selected fit model appears in the NLLS palette.
- Rename the fit model as needed.

- Use the padlock icons to constrain fit parameters (for example, fixing peak position or width).
Evaluate fit quality
Enable 1D Fit to overlay the live fit on the spectral data and assess fit quality:
- If the total fit closely matches the raw data and the residual is low with no strong features, the fit is good and no additional models or constraints are required.

- If the total fit does not match the data and the residual is large or contains strong features, the fit is poor and the fit models and/or parameter constraints should be adjusted.
Refine the fit by adding, removing, or adjusting models, using the live fit as a guide.

Generate NLLS fit maps
When you are satisfied with the fit model:
- Select Map to open the fit map options dialog.
- Configure output options:
- Fit parameter output – Outputs and labels individual model parameters (for example, amplitude, center, and width for a Gaussian model).
- Fit model output – Outputs the computed model for each fitting region.
- Confirm the settings and start the computation.

The software performs NLLS fitting pixel‑by‑pixel across the dataset, using the defined fit regions and parameters from the exploration spectrum. The resulting parameter maps are displayed in a new workspace.
