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

Least Squares fitting of spectral elements to spectrum. More...

#include <SpectralFit.h>

Public Member Functions

 SpectralFit ()
 Default constructor creates a default fitter without elements. More...
 
 SpectralFit (const SpectralList &in)
 Construct for the given elements. More...
 
 SpectralFit (const SpectralFit &other)
 Copy constructor (deep copy) More...
 
 ~SpectralFit ()
 Destructor. More...
 
SpectralFitoperator= (const SpectralFit &other)
 Assignment (copy semantics) More...
 
void setFitElement (casacore::uInt index, const SpectralElement &elem)
 Set an element to be fitted. More...
 
void addFitElement (const SpectralElement &elem)
 Add elements to be fitted. More...
 
void addFitElement (const SpectralList &elem)
 
void clear ()
 Clear the list to be fitted (for a re-use of the SpectralFit object) More...
 
const SpectralListlist () const
 Get the list being fitted. More...
 
template<class MT >
casacore::Bool fit (const casacore::Vector< MT > &y, const casacore::Vector< MT > &x)
 Fit the elements as given by the specified spectral elements at the frequencies x with values y. More...
 
template<class MT >
casacore::Bool fit (const casacore::Vector< MT > &y, const casacore::Vector< MT > &x, const casacore::Vector< casacore::Bool > &mask)
 
template<class MT >
casacore::Bool fit (const casacore::Vector< MT > &sigma, const casacore::Vector< MT > &y, const casacore::Vector< MT > &x)
 Fit the elements as given by the specified spectral elements at the frequencies x with values y and weights sigma. More...
 
template<class MT >
casacore::Bool fit (const casacore::Vector< MT > &sigma, const casacore::Vector< MT > &y, const casacore::Vector< MT > &x, const casacore::Vector< casacore::Bool > &mask)
 
casacore::uInt nIterations () const
 Get the number of iterations last fit. More...
 
casacore::Double chiSq () const
 Get ChiSq of the last fit. More...
 

Private Member Functions

template<class MT >
casacore::Bool fit (const casacore::Vector< MT > &y, const casacore::Vector< MT > &x, const casacore::Vector< casacore::Bool > *mask)
 Real fitters. More...
 
template<class MT >
casacore::Bool fit (const casacore::Vector< MT > &sigma, const casacore::Vector< MT > &y, const casacore::Vector< MT > &x, const casacore::Vector< casacore::Bool > *mask)
 

Private Attributes

SpectralList slist_p
 Elements to be fitted. More...
 
casacore::uInt iter_p
 Number of iterations last fit. More...
 
casacore::Double chiSq_p
 ChiSq of last fit. More...
 

Detailed Description

Least Squares fitting of spectral elements to spectrum.

Intended use:

Public interface

Review Status

Date Reviewed:
yyyy/mm/dd
Test programs:
tSpectralFit

Prerequisite

Etymology

From spectral line and fitting

Synopsis

The SpectralFit class will do a non-linear least squares solution for a number of simultaneous spectral components. The initial guess of the elements is given in a set of SpectralElements. The final solution is returned in the same set.

Example

Motivation

To have a contained fitting of spectral profiles to an observed spectrum

To Do

Definition at line 83 of file SpectralFit.h.

Constructor & Destructor Documentation

casa::SpectralFit::SpectralFit ( )

Default constructor creates a default fitter without elements.

casa::SpectralFit::SpectralFit ( const SpectralList in)
explicit

Construct for the given elements.

casa::SpectralFit::SpectralFit ( const SpectralFit other)

Copy constructor (deep copy)

casa::SpectralFit::~SpectralFit ( )

Destructor.

Member Function Documentation

void casa::SpectralFit::addFitElement ( const SpectralElement elem)

Add elements to be fitted.

void casa::SpectralFit::addFitElement ( const SpectralList elem)
casacore::Double casa::SpectralFit::chiSq ( ) const
inline

Get ChiSq of the last fit.

Definition at line 153 of file SpectralFit.h.

References chiSq_p.

Referenced by casa::ProfileFit1D< FitterType >::getChiSquared().

void casa::SpectralFit::clear ( )

Clear the list to be fitted (for a re-use of the SpectralFit object)

template<class MT >
casacore::Bool casa::SpectralFit::fit ( const casacore::Vector< MT > &  y,
const casacore::Vector< MT > &  x 
)
inline

Fit the elements as given by the specified spectral elements at the frequencies x with values y.

Weights of all points are equal. The mask (if specified) means: use point if true. Returns the convergence status.

Definition at line 125 of file SpectralFit.h.

Referenced by fit().

template<class MT >
casacore::Bool casa::SpectralFit::fit ( const casacore::Vector< MT > &  y,
const casacore::Vector< MT > &  x,
const casacore::Vector< casacore::Bool > &  mask 
)
inline

Definition at line 128 of file SpectralFit.h.

References fit().

template<class MT >
casacore::Bool casa::SpectralFit::fit ( const casacore::Vector< MT > &  sigma,
const casacore::Vector< MT > &  y,
const casacore::Vector< MT > &  x 
)
inline

Fit the elements as given by the specified spectral elements at the frequencies x with values y and weights sigma.

The mask (if specified) means: use point if true.

Definition at line 138 of file SpectralFit.h.

References fit().

template<class MT >
casacore::Bool casa::SpectralFit::fit ( const casacore::Vector< MT > &  sigma,
const casacore::Vector< MT > &  y,
const casacore::Vector< MT > &  x,
const casacore::Vector< casacore::Bool > &  mask 
)
inline

Definition at line 143 of file SpectralFit.h.

References fit().

template<class MT >
casacore::Bool casa::SpectralFit::fit ( const casacore::Vector< MT > &  y,
const casacore::Vector< MT > &  x,
const casacore::Vector< casacore::Bool > *  mask 
)
private

Real fitters.

template<class MT >
casacore::Bool casa::SpectralFit::fit ( const casacore::Vector< MT > &  sigma,
const casacore::Vector< MT > &  y,
const casacore::Vector< MT > &  x,
const casacore::Vector< casacore::Bool > *  mask 
)
private
const SpectralList& casa::SpectralFit::list ( ) const
inline

Get the list being fitted.

Definition at line 117 of file SpectralFit.h.

References slist_p.

casacore::uInt casa::SpectralFit::nIterations ( ) const
inline

Get the number of iterations last fit.

Definition at line 150 of file SpectralFit.h.

References iter_p.

Referenced by casa::ProfileFit1D< FitterType >::getNumberIterations().

SpectralFit& casa::SpectralFit::operator= ( const SpectralFit other)

Assignment (copy semantics)

void casa::SpectralFit::setFitElement ( casacore::uInt  index,
const SpectralElement elem 
)

Set an element to be fitted.

Thrown Exceptions

Member Data Documentation

casacore::Double casa::SpectralFit::chiSq_p
private

ChiSq of last fit.

Definition at line 162 of file SpectralFit.h.

Referenced by chiSq().

casacore::uInt casa::SpectralFit::iter_p
private

Number of iterations last fit.

Definition at line 160 of file SpectralFit.h.

Referenced by nIterations().

SpectralList casa::SpectralFit::slist_p
private

Elements to be fitted.

Definition at line 158 of file SpectralFit.h.

Referenced by list().


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