SpectralFit.h

Classes

SpectralFit -- Least Squares fitting of spectral elements to spectrum (full description)

class SpectralFit

Interface

Public Members
SpectralFit()
explicit SpectralFit(const SpectralList &in)
SpectralFit(const SpectralFit &other)
~SpectralFit()
SpectralFit &operator=(const SpectralFit &other)
void setFitElement(uInt index, const SpectralElement &elem)
void addFitElement(const SpectralElement &elem)
void addFitElement(const SpectralList &elem)
void clear()
const SpectralList &list() const
template <class MT> Bool fit(const MT<MT> &y, const MT<MT> &x)
template <class MT> Bool fit(const MT<MT> &y, const MT<MT> &x, const MT<Bool> &mask)
template <class MT> Bool fit(const MT<MT> &sigma, const MT<MT> &y, const MT<MT> &x)
template <class MT> Bool fit(const MT<MT> &sigma, const MT<MT> &y, const MT<MT> &x, const MT<Bool> &mask)
uInt nIterations() const
Double chiSq () const
Private Members
template <class MT> Bool fit(const MT<MT> &y, const MT<MT> &x, const MT<Bool> *mask)
template <class MT> Bool fit(const MT<MT> &sigma, const MT<MT> &y, const MT<MT> &x, const MT<Bool> *mask)

Description

Review Status

Date Reviewed:
yyyy/mm/dd
Programs:
Tests:

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

Member Description

SpectralFit()

Default constructor creates a default fitter without elements

explicit SpectralFit(const SpectralList &in)

Construct for the given elements

SpectralFit(const SpectralFit &other)

Copy constructor (deep copy)

~SpectralFit()

Destructor

SpectralFit &operator=(const SpectralFit &other)

Assignment (copy semantics)

void setFitElement(uInt index, const SpectralElement &elem)

Set an element to be fitted

Thrown Exceptions

void addFitElement(const SpectralElement &elem)
void addFitElement(const SpectralList &elem)

Add elements to be fitted

void clear()

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

const SpectralList &list() const

Get the list being fitted

template <class MT> Bool fit(const MT<MT> &y, const MT<MT> &x)
template <class MT> Bool fit(const MT<MT> &y, const MT<MT> &x, const MT<Bool> &mask)

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.

template <class MT> Bool fit(const MT<MT> &sigma, const MT<MT> &y, const MT<MT> &x)
template <class MT> Bool fit(const MT<MT> &sigma, const MT<MT> &y, const MT<MT> &x, const MT<Bool> &mask)

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.

uInt nIterations() const

Get the number of iterations last fit

Double chiSq () const

Get ChiSq of the last fit

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

Real fitters