casa::SpectralFit Class Reference
[SpectralComponents]

#include <SpectralFit.h>

Collaboration diagram for casa::SpectralFit:

Collaboration graph
[legend]
List of all members.

Detailed Description

Least Squares fitting of spectral elements to spectrum.

Intended use:

Part of API

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 79 of file SpectralFit.h.

Public Member Functions

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

Private Member Functions

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

Private Attributes

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


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

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

Assignment (copy semantics).

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

Set an element to be fitted.

Thrown Exceptions

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

Add elements to be fitted.

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

void casa::SpectralFit::clear (  ) 

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

const SpectralList& casa::SpectralFit::list (  )  const [inline]

Get the list being fitted.

Definition at line 113 of file SpectralFit.h.

References slist_p.

template<class MT>
Bool casa::SpectralFit::fit ( const Vector< MT > &  y,
const 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 121 of file SpectralFit.h.

Referenced by fit().

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

Definition at line 124 of file SpectralFit.h.

References fit(), and casa::mask().

template<class MT>
Bool casa::SpectralFit::fit ( const Vector< MT > &  sigma,
const Vector< MT > &  y,
const 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 134 of file SpectralFit.h.

References fit().

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

Definition at line 139 of file SpectralFit.h.

References fit(), and casa::mask().

uInt casa::SpectralFit::nIterations (  )  const [inline]

Get the number of iterations last fit.

Definition at line 146 of file SpectralFit.h.

References iter_p.

Referenced by casa::ProfileFit1D< NumericTraits< T >::PrecisionType >::getNumberIterations().

Double casa::SpectralFit::chiSq (  )  const [inline]

Get ChiSq of the last fit.

Definition at line 149 of file SpectralFit.h.

References chiSq_p.

Referenced by casa::ProfileFit1D< NumericTraits< T >::PrecisionType >::getChiSquared().

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

Real fitters.

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


Member Data Documentation

SpectralList casa::SpectralFit::slist_p [private]

Elements to be fitted.

Definition at line 154 of file SpectralFit.h.

Referenced by list().

uInt casa::SpectralFit::iter_p [private]

Number of iterations last fit.

Definition at line 156 of file SpectralFit.h.

Referenced by nIterations().

Double casa::SpectralFit::chiSq_p [private]

ChiSq of last fit.

Definition at line 158 of file SpectralFit.h.

Referenced by chiSq().


The documentation for this class was generated from the following file:
Generated on Tue Aug 26 22:34:57 2008 for NRAOCASA by  doxygen 1.5.1