3.3.1.96. NXfit

Status:

base class, extends NXprocess

Description:

Description of a fit procedure using a scalar valued global function

Symbols:

The symbols used in the schema to specify e.g. dimensions of arrays.

dimRank: Rank of the dependent and independent data arrays (for multivariate scalar-valued fit.)

Groups cited:

NXdata, NXfit_function, NXpeak

Structure:

label: (optional) NX_CHAR

Human-readable label for this fit procedure.

data: (optional) NXdata ⤆

Data and results of the fit.

input_independent: (optional) NX_NUMBER (Rank: dimRank) {units=NX_ANY}

Independent variable(s) for this fit procedure, representing the values to b …

Independent variable(s) for this fit procedure, representing the values to be fitted by the global_fit_function.

input_dependent: (optional) NX_NUMBER (Rank: dimRank) {units=NX_ANY}

Dependent variable(s) for this fit procedure (i.e., the observed data).

fit_sum: (optional) NX_NUMBER (Rank: dimRank) {units=NX_ANY}

Resulting fit obtained by evaluating the global_fit_function at the poin …

Resulting fit obtained by evaluating the global_fit_function at the points specified in input_independent using the optimized fit parameters. This represents the best-fit curve or surface approximating the input_dependent data.

residual: (optional) NX_NUMBER (Rank: dimRank) {units=NX_ANY}

The difference between the observed data (input_dependent) and the predi …

The difference between the observed data (input_dependent) and the predicted fit values (fit_sum). A lower magnitude of residuals indicates a better fit.

peakPEAK: (optional) NXpeak

An instance of the peak model. …

An instance of the peak model. If there is no characteristic name for each peak component, the peaks could be labeled as peak_0, peak_1, and so on.

total_area: (optional) NX_NUMBER {units=NX_ANY} ⤆

Total area under the curve (can also be used for the total area minus any …

Total area under the curve (can also be used for the total area minus any background values).

relative_sensitivity_factor: (optional) NX_NUMBER {units=NX_UNITLESS}

Relative sensitivity for this peak, to be used for quantification in …

Relative sensitivity for this peak, to be used for quantification in an NXprocess.

As an example, in X-ray spectroscopy could depend on the energy scale (see position), the ionization cross section, and the element probed.

relative_area: (optional) NX_NUMBER {units=NX_ANY}

Relative area of this peak compared to other peaks. …

Relative area of this peak compared to other peaks.

The relative area can simply be derived by dividing the total_area by the total area of all peaks or by a more complicated method (e.g., by additionally dividing by the relative sensitivity factors). Details shall be given in global_fit_function.

backgroundBACKGROUND: (optional) NXpeak

One fitted background (functional form, position (see …

One fitted background (functional form, position (see data/input_independent), and intensities) of the peak fit. If there is no characteristic name for each background component, it is envisioned that backgrounds are labeled as background_0, background_1, and so on.

global_fit_function: (optional) NXfit_function

formula_description: (optional) NX_CHAR ⤆

Often, if the peaks and fit backgrounds are defined independently (i.e, with …

Often, if the peaks and fit backgrounds are defined independently (i.e, with their own parameter sets), the resulting global fit is a function of the form \(model = peak_1(p_1) + peak2(p_2) + backgr(p_3).\), where each \(p_x\) describes the set of parameters for one peak/background.

error_function: (optional) NXfit_function

Function used to optimize the parameters during peak fitting.

description: (optional) NX_CHAR ⤆

Description of the method used to optimize the parameters during peak fittin …

Description of the method used to optimize the parameters during peak fitting. Examples:

  • least squares

  • nonlinear least squares

  • Levenberg-Marquardt algorithm (damped least-squares)

  • linear regression

  • Bayesian linear regression

formula_description: (optional) NX_CHAR ⤆

For the optimization, the formula is any optimization process on the …

For the optimization, the formula is any optimization process on the global_fit_function given above. As an example, for a least squares algorithm on independent components, the formula of the error_function would be \(LLS(peak_1(p_1) + peak_2(p_2) + backgr(p_3))\), where each \(p_i\) describes the set of parameters for one peak/background. In this case, the formula_description can be expressed as \(min(\chi^2)\), where \(\chi^2\) is the sum of squared residuals between the model and the observed data: \(min(\chi^2) = \sum_{i=1}^{N} \left( y_i - \left( \text{peak}_1(p_1, x_i) + \text{peak}_2(p_2, x_i) + \text{backgr}(p_3, x_i) \right) \right)^2\)

It is however also possible to supply more involved formulas (e.g., in the case of constrained fits).

figure_of_meritMETRIC: (optional) NX_NUMBER {units=NX_UNITLESS}

Figure-of-merit to determine the goodness of fit, i.e., how well the fit model …

Figure-of-merit to determine the goodness of fit, i.e., how well the fit model (i.e., the set of peaks and backgrounds) fits the measured observations.

This value (which is a single number) is often used to guide adjustments to the fitting parameters in the peak fitting process.

@metric: (optional) NX_CHAR

Metric used to determine the goodness of fit. Examples include: …

Metric used to determine the goodness of fit. Examples include:

  • \(\chi^2\), the squared sum of the sigma-weighted residuals

  • reduced \(\chi^2\):, \(\chi^2\): per degree of freedom

  • \(R^2\), the coefficient of determination

Hypertext Anchors

List of hypertext anchors for all groups, fields, attributes, links, and symbols defined in this class.

NXDL Source:

https://github.com/nexusformat/definitions/blob/main/base_classes/NXfit.nxdl.xml