casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
casa::SpectralFitter Class Reference

#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 More...
 
virtual ~SpectralFitter ()
 destructor More...
 
virtual casacore::Bool fit (const casacore::Vector< casacore::Float > &spcVals, const casacore::Vector< casacore::Float > &yVals, const casacore::Vector< casacore::Float > &eVals, const casacore::Float startVal, const casacore::Float endVal, const casacore::Bool fitGauss, const casacore::Bool fitPoly, const casacore::uInt nPoly, casacore::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. More...
 
const SpectralFitter::FitStatusgetStatus ()
 get the status of the last fit More...
 
casacore::Double getChiSquared () const
 get Chi Squared of the last fit More...
 
casacore::Double getNumberIterations () const
 get number of iterations for the last fit More...
 
const SpectralListgetList () const
 
casacore::Vector
< casacore::Double
getFit () const
 get all values for the last fit More...
 
void getFit (const casacore::Vector< casacore::Float > &spcVals, casacore::Vector< casacore::Float > &spcFit, casacore::Vector< casacore::Float > &yFit) const
 get the values in the specified data range for the last fit More...
 
casacore::Vector
< casacore::Double
getResidual () const
 get all residuals for the last fit More...
 
casacore::String report (casacore::LogIO &os, const casacore::String &xUnit="", const casacore::String &yUnit="", const casacore::String &yPrefixUnit="") const
 report on the last fit to a stream More...
 

Private Member Functions

void _setUp ()
 do all necessary setup More...
 
casacore::Bool _prepareData (const casacore::Vector< casacore::Float > &xVals, const casacore::Vector< casacore::Float > &eVals, const casacore::Int &startIndex, const casacore::Int &endIndex, casacore::Vector< casacore::Bool > &maskVals, casacore::Vector< casacore::Double > &weightVals) const
 prepare the data which means give all data (independent, dependent, weights) to the fitting class More...
 
casacore::Bool _prepareElems (const casacore::Bool fitGauss, const casacore::Bool fitPoly, const casacore::uInt nPoly, casacore::Vector< casacore::Double > &xVals, casacore::Vector< casacore::Double > &yVals, SpectralList &list)
 prepare the components that shall be fitted; this includes the setting of reasonable initial parameters More...
 
casacore::String _report (casacore::LogIO &os, const SpectralList &list, const casacore::String &xUnit="", const casacore::String &yUnit="", const casacore::String &yPrefixUnit="") const
 report on a list of spectral elements to a stream More...
 

Private Attributes

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

Detailed Description

Definition at line 48 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 71 of file SpectralFitter.h.

Constructor & Destructor Documentation

casa::SpectralFitter::SpectralFitter ( )

default constructor

virtual casa::SpectralFitter::~SpectralFitter ( )
virtual

destructor

Member Function Documentation

casacore::Bool casa::SpectralFitter::_prepareData ( const casacore::Vector< casacore::Float > &  xVals,
const casacore::Vector< casacore::Float > &  eVals,
const casacore::Int startIndex,
const casacore::Int endIndex,
casacore::Vector< casacore::Bool > &  maskVals,
casacore::Vector< casacore::Double > &  weightVals 
) const
private

prepare the data which means give all data (independent, dependent, weights) to the fitting class

casacore::Bool casa::SpectralFitter::_prepareElems ( const casacore::Bool  fitGauss,
const casacore::Bool  fitPoly,
const casacore::uInt  nPoly,
casacore::Vector< casacore::Double > &  xVals,
casacore::Vector< casacore::Double > &  yVals,
SpectralList list 
)
private

prepare the components that shall be fitted; this includes the setting of reasonable initial parameters

casacore::String casa::SpectralFitter::_report ( casacore::LogIO os,
const SpectralList list,
const casacore::String xUnit = "",
const casacore::String yUnit = "",
const casacore::String yPrefixUnit = "" 
) const
private

report on a list of spectral elements to a stream

void casa::SpectralFitter::_setUp ( )
private

do all necessary setup

virtual casacore::Bool casa::SpectralFitter::fit ( const casacore::Vector< casacore::Float > &  spcVals,
const casacore::Vector< casacore::Float > &  yVals,
const casacore::Vector< casacore::Float > &  eVals,
const casacore::Float  startVal,
const casacore::Float  endVal,
const casacore::Bool  fitGauss,
const casacore::Bool  fitPoly,
const casacore::uInt  nPoly,
casacore::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.

casacore::Double casa::SpectralFitter::getChiSquared ( ) const
inline

get Chi Squared of the last fit

Definition at line 100 of file SpectralFitter.h.

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

casacore::Vector<casacore::Double> casa::SpectralFitter::getFit ( ) const
inline

get all values for the last fit

Definition at line 108 of file SpectralFitter.h.

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

void casa::SpectralFitter::getFit ( const casacore::Vector< casacore::Float > &  spcVals,
casacore::Vector< casacore::Float > &  spcFit,
casacore::Vector< casacore::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 105 of file SpectralFitter.h.

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

casacore::Double casa::SpectralFitter::getNumberIterations ( ) const
inline

get number of iterations for the last fit

Definition at line 103 of file SpectralFitter.h.

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

casacore::Vector<casacore::Double> casa::SpectralFitter::getResidual ( ) const
inline

get all residuals for the last fit

Definition at line 114 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 97 of file SpectralFitter.h.

References _fitStatus.

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

report on the last fit to a stream

Member Data Documentation

casacore::uInt casa::SpectralFitter::_endIndex
private

Definition at line 129 of file SpectralFitter.h.

casacore::Double casa::SpectralFitter::_endVal
private

Definition at line 127 of file SpectralFitter.h.

ProfileFit1D<casacore::Double> casa::SpectralFitter::_fit
private

Definition at line 122 of file SpectralFitter.h.

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

SpectralFitter::FitStatus casa::SpectralFitter::_fitStatus
private

Definition at line 124 of file SpectralFitter.h.

Referenced by getStatus().

casacore::LogIO* casa::SpectralFitter::_log
private

Definition at line 120 of file SpectralFitter.h.

casacore::String casa::SpectralFitter::_resultMsg
private

Definition at line 131 of file SpectralFitter.h.

casacore::uInt casa::SpectralFitter::_startIndex
private

Definition at line 128 of file SpectralFitter.h.

casacore::Double casa::SpectralFitter::_startVal
private

Definition at line 126 of file SpectralFitter.h.


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