Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Non-Linear Least Square Fitting
Fitting experimental data to physical models is often necessary in data analysis. SpectraFox includes a fit-engine that allows to fit data of a single spectrum, or even of two different datasets with coupled parameter sets. It supports as well the combined fit of multiple fit-models simultaneously.
Depending on whether a single dataset or two datasets shall be fitted, you can open the fit dialog after selecting the files in the data browser via the context menus of the list, or on top of the list.
Non-Linear Fit of Single Spectroscopy Files
The fit-dialog consists out of many different parts, that are required to be set up.
- In (A) we set up the fit-algorithm, and its properties, that are used for the least-square optimization.
SpectraFox supports the following fit algorithms:
- Nelder-Mead algorithm (default): This algorithm is quite robust against non-optimal start conditions of the parameters. It is not as quickly approaching a minumum in parameter space, as other algorithms.
- Levenberg-Marquart algorithm: This algorithm requires more accurate start conditions, but is much faster finding a local minimum in parameter-space.
- (B) launches the fit immediately, whereas (C) allows to add each fit-dialog to a queue, which is worked through one after another.
- (D) shows the output of the fit-algorithm, usually echoing the current parameter set, and any progress in finding better parameters.
- (E) shows the data to be fitted, that is selected in (F). Also a preview of the current fit-model with its parameters is shown.
- With (G) you can [add fit-models](FitModels] to the current dataset. You can add as many models as you like. SpectraFox combines these models to a single fit-function.
- (H) shows a list of all fit-models currently added. You can modify the fit-parameters, lock them, or give them boundaries.
- In (J) you can export or import the current status of the fit.
- After fitting you can generate data according to the fit-models as new data column in (K). The fit-procedure output can be stored to the extended comment section of the source data file.
If you set up the fit-model with your first guess of the parameters you can launch the fit. If the fit is not converging quickly you can cancel and restart the fit several times to obtain better results.
Changing a Fit-Parameter
Fit-parameters are adjustable via this input unit:
- By clicking on the lock-symbol (1) you can lock a parameter and exclude it from the fit.
- A click on the on the chain-symbol (2) opens a menu to lock parameters together, and modify their values simultaneously.
- A click on the smaller/larger-than-symbol (3) allows you to set boundaries for the values of the fit-parameter.
Non-Linear Fit of Two Spectroscopy Files
Two datasets can be fitted simultaneously with different fit-models, and with parameters which are coupled across the two models. This can be helpful to optimize parameters over several datasets. The properties of the fit-dialog are similar to the dialog for single files. Just the output is dedicated to two different datasets.