Linear
From MantidProject
Contents |
Summary
Performs linear least-squares regression on a spectrum (or portion of one).
Properties
| Order | Name | Direction | Type | Default | Description |
|---|---|---|---|---|---|
| 1 | InputWorkspace | Input | Workspace | Mandatory | The name of the workspace containing the spectrum to fit. |
| 2 | OutputWorkspace | Output | Workspace1D | Mandatory | A Workspace1D containing the fit result and errors for the X values of the input spectrum. |
| 3 | SpectrumIndex | Input | integer | 0 | The workspace index of the spectrum to fit. |
| 4 | StartX | Input | double | Spectrum minimum | The X value to start fitting from. |
| 5 | EndX | Input | double | Spectrum maximum | The last X value to include in the fitting range. |
| 6 | FitStatus | Output | string | Empty if the fit succeeded, otherwise contains the gsl error message. | |
| 7 | FitIntercept | Output | double | The intercept with the ordinate of the fitted line. c0 in the equation below. | |
| 8 | FitSlope | Output | double | The slope of the fitted line. c1 in the equation below. | |
| 9 | Chi2 | Output | double | The χ2 value for the goodness of the fit. |
Description
This algorithm fits a line, of the form Y = c0 + c1X, to the specified part of a particular spectrum. As well as outputting the result to the log (debug level) and as output properties, a 1D workspace is created with the same X bins/points as the fitted spectrum and the value and error on the fit at each point. The covariance matrix is not currently returned as an output: if this is required please contact the development team.
References
This algorithm uses the gsl linear regression algorithms gsl_fit_linear and gsl_fit_wlinear, which are documented here.
Source Code
Header Linear.h
Source Linear.cpp
