casa
5.7.0-16
|
Fit spectral components to a casacore::Vector of data. More...
#include <ProfileFit1D.h>
Private Member Functions | |
casacore::Vector< casacore::Bool > | makeTotalMask () const |
Functions. More... | |
SpectralList | getSubsetList (const SpectralList &list, casacore::Int which) const |
void | checkType () const |
void | copy (const ProfileFit1D< T > &other) |
Fit spectral components to a casacore::Vector of data.
Public interface
Fit lists (held in class SpectralList) of SpectralElements to a casacore::Vector of data. Each SpectralElement can be one from a variety of types. The values of the parameters for each SpectralElement provide the initial starting guesses for the fitting process. Also, a SpectralElement object holds a mask indicating whether a parameter should be held fixed or solved for. After the fitting is done, a new SpectralList holding SpectralElements with the fitted parameters is created.
For all the functions that return a status casacore::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.
Caution: 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;
Definition at line 103 of file ProfileFit1D.h.
casa::ProfileFit1D< T >::ProfileFit1D | ( | ) |
Constructor.
casa::ProfileFit1D< T >::~ProfileFit1D | ( | ) |
Destructor.
casa::ProfileFit1D< T >::ProfileFit1D | ( | const ProfileFit1D< T > & | other | ) |
Copy constructor.
Uses copy semantics.
void casa::ProfileFit1D< T >::addElement | ( | const SpectralElement & | el | ) |
Add new SpectralElement(s) to the SpectralList (can be empty) of SpectralElements to be fit for.
Referenced by casa::ImageFit1D< T >::addElement().
void casa::ProfileFit1D< T >::addElements | ( | const SpectralList & | list | ) |
Referenced by casa::ImageFit1D< T >::addElements().
|
private |
void casa::ProfileFit1D< T >::clearList | ( | ) |
Clear the SpectralList of elements to be fit for.
Referenced by casa::ImageFit1D< T >::clearList().
|
private |
|
inline |
Recover the error message.
Definition at line 220 of file ProfileFit1D.h.
casacore::Bool casa::ProfileFit1D< T >::fit | ( | ) |
Do the fit and return status.
Returns convergence status. Error conditions in the solution process will generate an casacore::AipsError exception and you should catch these yourself.
|
inline |
Get Chi Squared of fit.
Definition at line 197 of file ProfileFit1D.h.
Referenced by casa::SpectralFitter::getChiSquared(), and casa::ImageFit1D< T >::getChiSquared().
|
inline |
Recover masks.
These are the data mask (setData) the range mask (setRangeMask may be length zero) and the total mask combining the two.
Definition at line 186 of file ProfileFit1D.h.
Referenced by casa::ImageFit1D< T >::getDataMask().
casacore::Vector<T> casa::ProfileFit1D< T >::getEstimate | ( | casacore::Int | which = -1 | ) | const |
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
.
casacore::Vector<T> casa::ProfileFit1D< T >::getFit | ( | casacore::Int | which = -1 | ) | const |
Referenced by casa::SpectralFitter::getFit().
const SpectralList& casa::ProfileFit1D< T >::getList | ( | casacore::Bool | fit = true | ) | const |
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.
Referenced by casa::SpectralFitter::getList(), and casa::ImageFit1D< T >::getList().
|
inline |
Get number of iterations for last fit.
Definition at line 200 of file ProfileFit1D.h.
Referenced by casa::SpectralFitter::getNumberIterations(), and casa::ImageFit1D< T >::getNumberIterations().
|
inline |
Definition at line 187 of file ProfileFit1D.h.
casacore::Vector<T> casa::ProfileFit1D< T >::getResidual | ( | casacore::Int | which = -1 , |
casacore::Bool | fit = true |
||
) | const |
Referenced by casa::SpectralFitter::getResidual().
|
private |
|
inline |
Definition at line 188 of file ProfileFit1D.h.
Referenced by casa::ImageFit1D< T >::getTotalMask().
|
private |
Functions.
Referenced by casa::ProfileFit1D< FitterType >::getTotalMask().
ProfileFit1D& casa::ProfileFit1D< T >::operator= | ( | const ProfileFit1D< T > & | other | ) |
Assignment operator.
Uses copy semantics.
casacore::Bool casa::ProfileFit1D< T >::setData | ( | const casacore::Vector< casacore::Double > & | x, |
const casacore::Vector< T > & | y, | ||
const casacore::Vector< casacore::Bool > & | mask, | ||
const casacore::Vector< casacore::Double > & | weight | ||
) |
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
casacore::Bool casa::ProfileFit1D< T >::setData | ( | const casacore::Vector< casacore::Double > & | x, |
const casacore::Vector< T > & | y, | ||
const casacore::Vector< casacore::Bool > & | mask | ||
) |
casacore::Bool casa::ProfileFit1D< T >::setData | ( | const casacore::Vector< casacore::Double > & | x, |
const casacore::Vector< T > & | y | ||
) |
void casa::ProfileFit1D< T >::setElements | ( | const SpectralList & | list | ) |
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.
Referenced by casa::ImageFit1D< T >::setElements().
casacore::Bool casa::ProfileFit1D< T >::setGaussianElements | ( | casacore::uInt | nGauss | ) |
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
casacore::Bool casa::ProfileFit1D< T >::setXMask | ( | const std::set< casacore::uInt > & | indices, |
casacore::Bool | specifiedPixelsAreGood | ||
) |
Referenced by casa::ImageFit1D< T >::setXMask().
casacore::Bool casa::ProfileFit1D< T >::setXRangeMask | ( | const casacore::Vector< casacore::uInt > & | startIndex, |
const casacore::Vector< casacore::uInt > & | endIndex, | ||
casacore::Bool | insideIsGood = true |
||
) |
Set abscissa 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
In the single set version, the values in the set indicate the pixels to set the mask for, ie no ranges, just specific pixels are to be provided. In this case, specified values which are greater than or equal to the number of pixels are tacitly ignored.
casacore::Bool casa::ProfileFit1D< T >::setXRangeMask | ( | const casacore::Vector< T > & | startIndex, |
const casacore::Vector< T > & | endIndex, | ||
casacore::Bool | insideIsGood = true |
||
) |
|
private |
Definition at line 226 of file ProfileFit1D.h.
Referenced by casa::ProfileFit1D< FitterType >::getDataMask().
|
mutableprivate |
Definition at line 232 of file ProfileFit1D.h.
|
private |
Definition at line 231 of file ProfileFit1D.h.
Referenced by casa::ProfileFit1D< FitterType >::getChiSquared(), and casa::ProfileFit1D< FitterType >::getNumberIterations().
|
private |
Definition at line 229 of file ProfileFit1D.h.
|
private |
Definition at line 227 of file ProfileFit1D.h.
Referenced by casa::ProfileFit1D< FitterType >::getRangeMask().
|
private |
Definition at line 225 of file ProfileFit1D.h.
|
private |
Definition at line 220 of file ProfileFit1D.h.
|
private |
Definition at line 224 of file ProfileFit1D.h.