#include <SpectralFitter.h>
Public Types | |
enum | FitStatus { UNKNOWN, FAILED, SUCCESS } |
Does a simple fit to data in vectors. It is possible to specify weights (or errors) for each element. A single Gaussian and a polynimial of order N are the only component that can be fitted. More... | |
Public Member Functions | |
SpectralFitter () | |
default constructor | |
virtual | ~SpectralFitter () |
destructor | |
virtual Bool | fit (const Vector< Float > &spcVals, const Vector< Float > &yVals, const Vector< Float > &eVals, const Float startVal, const Float endVal, const Bool fitGauss, const Bool fitPoly, const uInt nPoly, String &msg) |
Parameters: spcVals - independent values yVals - dependent values eVals - error values startVal - lower boundary for independent values to be included in the fit endVal - upper boundary for independent values to be included in the fit fitGauss - fit Gaussian component fitPoly - fit polynomial nPoly - order of polynomial to be fitted msg - message back to the calling routine. | |
const SpectralFitter::FitStatus & | getStatus () |
get the status of the last fit | |
Double | getChiSquared () const |
get Chi Squared of the last fit | |
Double | getNumberIterations () const |
get number of iterations for the last fit | |
const SpectralList & | getList () const |
Vector< Double > | getFit () const |
get all values for the last fit | |
void | getFit (const Vector< Float > &spcVals, Vector< Float > &spcFit, Vector< Float > &yFit) const |
get the values in the specified data range for the last fit | |
Vector< Double > | getResidual () const |
get all residuals for the last fit | |
String | report (LogIO &os, const String &xUnit="", const String &yUnit="", const String &yPrefixUnit="") const |
report on the last fit to a stream | |
Private Member Functions | |
void | _setUp () |
do all necessary setup | |
Bool | _prepareData (const Vector< Float > &xVals, const Vector< Float > &eVals, const Int &startIndex, const Int &endIndex, Vector< Bool > &maskVals, Vector< Double > &weightVals) const |
prepare the data which means give all data (independent, dependent, weights) to the fitting class | |
Bool | _prepareElems (const Bool fitGauss, const Bool fitPoly, const uInt nPoly, Vector< Double > &xVals, Vector< Double > &yVals, SpectralList &list) |
prepare the components that shall be fitted; this includes the setting of reasonable initial parameters | |
String | _report (LogIO &os, const SpectralList &list, const String &xUnit="", const String &yUnit="", const String &yPrefixUnit="") const |
report on a list of spectral elements to a stream | |
Private Attributes | |
LogIO * | _log |
ProfileFit1D< Double > | _fit |
SpectralFitter::FitStatus | _fitStatus |
Double | _startVal |
Double | _endVal |
uInt | _startIndex |
uInt | _endIndex |
String | _resultMsg |
Definition at line 44 of file SpectralFitter.h.
Does a simple fit to data in vectors. It is possible to specify weights (or errors) for each element. A single Gaussian and a polynimial of order N are the only component that can be fitted.
Created to fit components to spectra from the spectral profiler, hence SpectralFitter.
Definition at line 67 of file SpectralFitter.h.
casa::SpectralFitter::SpectralFitter | ( | ) |
default constructor
virtual casa::SpectralFitter::~SpectralFitter | ( | ) | [virtual] |
destructor
Bool casa::SpectralFitter::_prepareData | ( | const Vector< Float > & | xVals, | |
const Vector< Float > & | eVals, | |||
const Int & | startIndex, | |||
const Int & | endIndex, | |||
Vector< Bool > & | maskVals, | |||
Vector< Double > & | weightVals | |||
) | const [private] |
prepare the data which means give all data (independent, dependent, weights) to the fitting class
Bool casa::SpectralFitter::_prepareElems | ( | const Bool | fitGauss, | |
const Bool | fitPoly, | |||
const uInt | nPoly, | |||
Vector< Double > & | xVals, | |||
Vector< Double > & | yVals, | |||
SpectralList & | list | |||
) | [private] |
prepare the components that shall be fitted; this includes the setting of reasonable initial parameters
String casa::SpectralFitter::_report | ( | LogIO & | os, | |
const SpectralList & | list, | |||
const String & | xUnit = "" , |
|||
const String & | yUnit = "" , |
|||
const String & | yPrefixUnit = "" | |||
) | const [private] |
report on a list of spectral elements to a stream
void casa::SpectralFitter::_setUp | ( | ) | [private] |
do all necessary setup
virtual Bool casa::SpectralFitter::fit | ( | const Vector< Float > & | spcVals, | |
const Vector< Float > & | yVals, | |||
const Vector< Float > & | eVals, | |||
const Float | startVal, | |||
const Float | endVal, | |||
const Bool | fitGauss, | |||
const Bool | fitPoly, | |||
const uInt | nPoly, | |||
String & | msg | |||
) | [virtual] |
Parameters: spcVals
- independent values yVals
- dependent values eVals
- error values startVal
- lower boundary for independent values to be included in the fit endVal
- upper boundary for independent values to be included in the fit fitGauss
- fit Gaussian component fitPoly
- fit polynomial nPoly
- order of polynomial to be fitted msg
- message back to the calling routine.
Double casa::SpectralFitter::getChiSquared | ( | ) | const [inline] |
get Chi Squared of the last fit
Definition at line 96 of file SpectralFitter.h.
References _fit, and casa::ProfileFit1D< T >::getChiSquared().
void casa::SpectralFitter::getFit | ( | const Vector< Float > & | spcVals, | |
Vector< Float > & | spcFit, | |||
Vector< Float > & | yFit | |||
) | const |
get the values in the specified data range for the last fit
Vector<Double> casa::SpectralFitter::getFit | ( | ) | const [inline] |
get all values for the last fit
Definition at line 104 of file SpectralFitter.h.
References _fit, and casa::ProfileFit1D< T >::getFit().
const SpectralList& casa::SpectralFitter::getList | ( | ) | const [inline] |
Definition at line 101 of file SpectralFitter.h.
References _fit, and casa::ProfileFit1D< T >::getList().
Double casa::SpectralFitter::getNumberIterations | ( | ) | const [inline] |
get number of iterations for the last fit
Definition at line 99 of file SpectralFitter.h.
References _fit, and casa::ProfileFit1D< T >::getNumberIterations().
Vector<Double> casa::SpectralFitter::getResidual | ( | ) | const [inline] |
get all residuals for the last fit
Definition at line 110 of file SpectralFitter.h.
References _fit, and casa::ProfileFit1D< T >::getResidual().
const SpectralFitter::FitStatus& casa::SpectralFitter::getStatus | ( | ) | [inline] |
get the status of the last fit
Definition at line 93 of file SpectralFitter.h.
References _fitStatus.
String casa::SpectralFitter::report | ( | LogIO & | os, | |
const String & | xUnit = "" , |
|||
const String & | yUnit = "" , |
|||
const String & | yPrefixUnit = "" | |||
) | const |
report on the last fit to a stream
uInt casa::SpectralFitter::_endIndex [private] |
Definition at line 125 of file SpectralFitter.h.
Double casa::SpectralFitter::_endVal [private] |
Definition at line 123 of file SpectralFitter.h.
ProfileFit1D<Double> casa::SpectralFitter::_fit [private] |
Definition at line 118 of file SpectralFitter.h.
Referenced by getChiSquared(), getFit(), getList(), getNumberIterations(), and getResidual().
Definition at line 120 of file SpectralFitter.h.
Referenced by getStatus().
LogIO* casa::SpectralFitter::_log [private] |
Definition at line 116 of file SpectralFitter.h.
String casa::SpectralFitter::_resultMsg [private] |
Definition at line 127 of file SpectralFitter.h.
uInt casa::SpectralFitter::_startIndex [private] |
Definition at line 124 of file SpectralFitter.h.
Double casa::SpectralFitter::_startVal [private] |
Definition at line 122 of file SpectralFitter.h.