For all the functions that return a status Bool, True is good. If False is returned, an error message can be recovered with function errorMessage, You should not proceed if False is returned.
const uInt n = 512; Vector<Double> x(n); Vector<Double> y(n); Vector<Bool> m(n); // Code to fill data vectors x,y,m ProfileFit1D<Float> fitter; Bool ok = fitter.setData (x, y, m); ok = fitter.setGaussianElements (2); ok = fitter.fit(); const SpectralList& fitList = fitter.getList(True);
At the moment, because of templating limitations of the underlying fitting classes, you must use template type Double. This restriction will be lifted in the future.
Destructor
Copy constructor. Uses copy semantics.
Assignment operator. Uses copy semantics.
Set abcissa, ordinate, mask and weights. A True mask value means the data are good. If you don't specify the weights vector, all weights are assumed to be unity. If you don't specify a mask it will be created as all good. Status is returned, if False, error message can be recovered with errorMessage
Set a SpectralList of SpectralElements to fit for. The SpectralElements in the list hold the initial estimates and must reflect the abcissa and ordinate units. They also contain the information about whether specific parameters are to be held fixed or allowed to vary in the fitting process. You can recover the list of elements with function getList.
Set a SpectralList of Gaussian SpectralElements to fit for. The initial estimates for the Gaussians will be automatically determined. All of the parameters created by this function will be solved for by default. You can recover the list of elements with function getList. Status is returned, if False, error message can be recovered with errorMessage
Add new SpectralElement(s) to the SpectralList (can be empty) of SpectralElements to be fit for.
Clear the SpectralList of elements to be fit for
Set range mask. You can specify a number of ranges via a vector of start indices (or X values) and a vector of end indices (or X values). When argument insideIsGood is True, a mask will be created which will be True (good) inside the ranges and bad (False) outside of those ranges. When argument insideIsGood is False, the mask will be False (bad) inside the ranges and True (good) outside of those ranges. When the data are fit, a total mask is formed combining (via a logical AND) the data mask (setData) and this range mask. Status is returned, if False, error message can be recovered with errorMessage
Recover masks. These are the data mask (setData) the range mask (setRangeMask may be length zero) and the total mask combining the two.
Do the fit and return status. Returns convergence status. Error conditions in the solution process will generate an AipsError exception and you should catch these yourself.
Get Chi Squared of fit
Get number of iterations for last fit
Recover the list of elements. You can get the elements as initially estimated (fit=False), or after fitting (fit=True). In the latter case, the SpectralElements hold the parameters and errors of the fit.
Recover vectors for the estimate, fit and residual. If you don't specify which element, all elements are included If the Vectors are returned with zero length, it means an error condition exists (e.g. asking for fit before you do one). In this case an error message can be recovered with function errorMessage.
Recover the error message
Functions