.. auto-generated by dev_tools.docs.nxdl from the NXDL source base_classes/NXfit.nxdl.xml -- DO NOT EDIT .. index:: ! NXfit (base class) ! fit (base class) see: fit (base class); NXfit .. _NXfit: ===== NXfit ===== **Status**: base class, extends :ref:`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**: :ref:`NXdata`, :ref:`NXfit_function`, :ref:`NXpeak` .. index:: NXdata (base class); used in base class, NXpeak (base class); used in base class, NXfit_function (base class); used in base class **Structure**: .. _/NXfit/label-field: .. index:: label (field) **label**: (optional) :ref:`NX_CHAR ` Human-readable label for this fit procedure. .. _/NXfit/figure_of_meritMETRIC-field: .. index:: figure_of_meritMETRIC (field) **figure_of_merit**\ :bolditalic:`METRIC`: (optional) :ref:`NX_NUMBER ` {units=\ :ref:`NX_UNITLESS `} .. collapse:: 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. .. _/NXfit/figure_of_meritMETRIC@metric-attribute: .. index:: metric (field attribute) **@metric**: (optional) :ref:`NX_CHAR ` .. collapse:: Metric used to determine the goodness of fit. Examples include: ... Metric used to determine the goodness of fit. Examples include: - :math:`\chi^2`, the squared sum of the sigma-weighted residuals - reduced :math:`\chi^2`:, :math:`\chi^2`: per degree of freedom - :math:`R^2`, the coefficient of determination .. _/NXfit/data-group: **data**: (optional) :ref:`NXdata` :ref:`⤆ ` Data and results of the fit. .. _/NXfit/data/input_independent-field: .. index:: input_independent (field) **input_independent**: (optional) :ref:`NX_NUMBER ` (Rank: dimRank) {units=\ :ref:`NX_ANY `} .. collapse:: 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``. .. _/NXfit/data/input_dependent-field: .. index:: input_dependent (field) **input_dependent**: (optional) :ref:`NX_NUMBER ` (Rank: dimRank) {units=\ :ref:`NX_ANY `} Dependent variable(s) for this fit procedure (i.e., the observed data). .. _/NXfit/data/fit_sum-field: .. index:: fit_sum (field) **fit_sum**: (optional) :ref:`NX_NUMBER ` (Rank: dimRank) {units=\ :ref:`NX_ANY `} .. collapse:: 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. .. _/NXfit/data/residual-field: .. index:: residual (field) **residual**: (optional) :ref:`NX_NUMBER ` (Rank: dimRank) {units=\ :ref:`NX_ANY `} .. collapse:: 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. .. _/NXfit/peakPEAK-group: **peak**\ :bolditalic:`PEAK`: (optional) :ref:`NXpeak` .. collapse:: 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. .. _/NXfit/peakPEAK/total_area-field: .. index:: total_area (field) **total_area**: (optional) :ref:`NX_NUMBER ` {units=\ :ref:`NX_ANY `} :ref:`⤆ ` .. collapse:: 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). .. _/NXfit/peakPEAK/relative_sensitivity_factor-field: .. index:: relative_sensitivity_factor (field) **relative_sensitivity_factor**: (optional) :ref:`NX_NUMBER ` {units=\ :ref:`NX_UNITLESS `} .. collapse:: 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. .. _/NXfit/peakPEAK/relative_area-field: .. index:: relative_area (field) **relative_area**: (optional) :ref:`NX_NUMBER ` {units=\ :ref:`NX_ANY `} .. collapse:: 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`. .. _/NXfit/backgroundBACKGROUND-group: **background**\ :bolditalic:`BACKGROUND`: (optional) :ref:`NXpeak` .. collapse:: One fitted background (functional form, position (see :ref:`data/input_indepen ... One fitted background (functional form, position (see :ref:`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. .. _/NXfit/global_fit_function-group: **global_fit_function**: (optional) :ref:`NXfit_function` .. collapse:: Function used to describe the overall fit to the data, taking into account the ... Function used to describe the overall fit to the data, taking into account the parameters of the individual :ref:`NXpeak` components. .. _/NXfit/global_fit_function/formula_description-field: .. index:: formula_description (field) **formula_description**: (optional) :ref:`NX_CHAR ` :ref:`⤆ ` .. collapse:: 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 :math:`model = peak_1(p_1) + peak2(p_2) + backgr(p_3).`, where each :math:`p_x` describes the set of parameters for one peak/background. .. _/NXfit/error_function-group: **error_function**: (optional) :ref:`NXfit_function` Function used to optimize the parameters during peak fitting. .. _/NXfit/error_function/description-field: .. index:: description (field) **description**: (optional) :ref:`NX_CHAR ` :ref:`⤆ ` .. collapse:: 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 .. _/NXfit/error_function/formula_description-field: .. index:: formula_description (field) **formula_description**: (optional) :ref:`NX_CHAR ` :ref:`⤆ ` .. collapse:: For the optimization, the formula is any optimization process on the ``globa ... 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 :math:`LLS(peak_1(p_1) + peak_2(p_2) + backgr(p_3))`, where each :math:`p_i` describes the set of parameters for one peak/background. In this case, the ``formula_description`` can be expressed as :math:`min(\chi^2)`, where :math:`\chi^2` is the sum of squared residuals between the model and the observed data: :math:`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). Hypertext Anchors ----------------- List of hypertext anchors for all groups, fields, attributes, and links defined in this class. * :ref:`/NXfit/backgroundBACKGROUND-group ` * :ref:`/NXfit/data-group ` * :ref:`/NXfit/data/fit_sum-field ` * :ref:`/NXfit/data/input_dependent-field ` * :ref:`/NXfit/data/input_independent-field ` * :ref:`/NXfit/data/residual-field ` * :ref:`/NXfit/error_function-group ` * :ref:`/NXfit/error_function/description-field ` * :ref:`/NXfit/error_function/formula_description-field ` * :ref:`/NXfit/figure_of_meritMETRIC-field ` * :ref:`/NXfit/figure_of_meritMETRIC@metric-attribute ` * :ref:`/NXfit/global_fit_function-group ` * :ref:`/NXfit/global_fit_function/formula_description-field ` * :ref:`/NXfit/label-field ` * :ref:`/NXfit/peakPEAK-group ` * :ref:`/NXfit/peakPEAK/relative_area-field ` * :ref:`/NXfit/peakPEAK/relative_sensitivity_factor-field ` * :ref:`/NXfit/peakPEAK/total_area-field ` **NXDL Source**: https://github.com/FAIRmat-NFDI/nexus_definitions/tree/fairmat/base_classes/NXfit.nxdl.xml