casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Member Functions | Private Member Functions | Private Attributes
casa::SpectralFitter Class Reference

#include <SpectralFitter.h>

List of all members.

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::FitStatusgetStatus ()
 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 SpectralListgetList () const
Vector< DoublegetFit () 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< DoublegetResidual () const
 get all residuals for the last fit
void report () const
 report on on the last fit to the internal LogIO
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)
 Bool _prepareElems(const Bool fitGauss, const Vector<Double> gPars, const Bool fitPoly, const uInt nPoly, const Vector<Double> pPars, SpectralList& list);.
String _report (LogIO &os, const SpectralList &list, const String &xUnit="", const String &yUnit="", const String &yPrefixUnit="") const
 void _report(const ProfileFit1D<Double> &fit, const Bool print, String &report) const;

Private Attributes

LogIO_log
ProfileFit1D< Double_fit
SpectralFitter::FitStatus _fitStatus
Double _startVal
Double _endVal
uInt _startIndex
uInt _endIndex
String _resultMsg

Detailed Description

Definition at line 44 of file SpectralFitter.h.


Member Enumeration Documentation

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.

Prerequisite

Etymology

Created to fit components to spectra from the spectral profiler, hence SpectralFitter.

Synopsis

Enumerator:
UNKNOWN 
FAILED 
SUCCESS 

Definition at line 67 of file SpectralFitter.h.


Constructor & Destructor Documentation

default constructor

destructor


Member Function Documentation

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]

Bool _prepareElems(const Bool fitGauss, const Vector<Double> gPars, const Bool fitPoly, const uInt nPoly, const Vector<Double> pPars, SpectralList& list);.

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]

void _report(const ProfileFit1D<Double> &fit, const Bool print, String &report) const;

report on the last fit to a stream String _report(LogIO &os) const;

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.

get Chi Squared of the last fit

Definition at line 96 of file SpectralFitter.h.

References _fit, and casa::ProfileFit1D< T >::getChiSquared().

get all values for the last fit

Definition at line 104 of file SpectralFitter.h.

References _fit, and casa::ProfileFit1D< T >::getFit().

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

const SpectralList& casa::SpectralFitter::getList ( ) const [inline]

Definition at line 101 of file SpectralFitter.h.

References _fit, and casa::ProfileFit1D< T >::getList().

get number of iterations for the last fit

Definition at line 99 of file SpectralFitter.h.

References _fit, and casa::ProfileFit1D< T >::getNumberIterations().

get all residuals for the last fit

Definition at line 110 of file SpectralFitter.h.

References _fit, and casa::ProfileFit1D< T >::getResidual().

get the status of the last fit

Definition at line 93 of file SpectralFitter.h.

References _fitStatus.

report on on the last fit to the internal LogIO

String casa::SpectralFitter::report ( LogIO os,
const String xUnit = "",
const String yUnit = "",
const String yPrefixUnit = "" 
) const

report on the last fit to a stream


Member Data Documentation

Definition at line 129 of file SpectralFitter.h.

Definition at line 127 of file SpectralFitter.h.

Definition at line 122 of file SpectralFitter.h.

Referenced by getChiSquared(), getFit(), getList(), getNumberIterations(), and getResidual().

Definition at line 124 of file SpectralFitter.h.

Referenced by getStatus().

Definition at line 120 of file SpectralFitter.h.

Definition at line 131 of file SpectralFitter.h.

Definition at line 128 of file SpectralFitter.h.

Definition at line 126 of file SpectralFitter.h.


The documentation for this class was generated from the following file: