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

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

#include <SpectralFit.h>

List of all members.

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 addFitElement (const SpectralElement &elem)
 Add elements to be fitted.
void addFitElement (const SpectralList &elem)
void clear ()
 Clear the list to be fitted (for a re-use of the SpectralFit object)
const SpectralListlist () const
 Get the list being fitted.
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)
uInt nIterations () const
 Get the number of iterations last fit.
Double chiSq () const
 Get ChiSq of the last fit.

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.

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


Constructor & Destructor Documentation

Default constructor creates a default fitter without elements.

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

Construct for the given elements.

Copy constructor (deep copy)

Destructor.


Member Function Documentation

Add elements to be fitted.

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< FitterType >::getChiSquared().

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

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().

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().

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]
const SpectralList& casa::SpectralFit::list ( ) const [inline]

Get the list being fitted.

Definition at line 113 of file SpectralFit.h.

References slist_p.

Get the number of iterations last fit.

Definition at line 146 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 ( uInt  index,
const SpectralElement elem 
)

Set an element to be fitted.

Thrown Exceptions


Member Data Documentation

ChiSq of last fit.

Definition at line 158 of file SpectralFit.h.

Referenced by chiSq().

Number of iterations last fit.

Definition at line 156 of file SpectralFit.h.

Referenced by nIterations().

Elements to be fitted.

Definition at line 154 of file SpectralFit.h.

Referenced by list().


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