Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.atnf.csiro.au/computing/software/casacore/casacore-1.2.0/doc/html/SpectralFit_8h_source.html
Дата изменения: Unknown Дата индексирования: Mon Feb 14 21:03:11 2011 Кодировка: Поисковые слова: comet |
00001 //# SpectralFit.h: Least Squares fitting of spectral elements to spectrum 00002 //# Copyright (C) 2001,2002 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# 00027 //# $Id: SpectralFit.h 20229 2008-01-29 15:19:06Z gervandiepen $ 00028 00029 #ifndef COMPONENTS_SPECTRALFIT_H 00030 #define COMPONENTS_SPECTRALFIT_H 00031 00032 //# Includes 00033 #include <casa/aips.h> 00034 #include <components/SpectralComponents/SpectralList.h> 00035 00036 namespace casa { //# NAMESPACE CASA - BEGIN 00037 00038 //# Forward Declarations 00039 class SpectralElement; 00040 template <class T> class Vector; 00041 00042 // <summary> 00043 // Least Squares fitting of spectral elements to spectrum 00044 // </summary> 00045 00046 // <use visibility=export> 00047 00048 // <reviewed reviewer="" date="yyyy/mm/dd" tests="tSpectralFit" demos=""> 00049 // </reviewed> 00050 00051 // <prerequisite> 00052 // <li> <linkto module=Functionals>Functionals</linkto> module 00053 // <li> <linkto class=SpectralElement>SpectralElement</linkto> class 00054 // </prerequisite> 00055 // 00056 // <etymology> 00057 // From spectral line and fitting 00058 // </etymology> 00059 // 00060 // <synopsis> 00061 // The SpectralFit class will do a non-linear least squares solution 00062 // for a number of simultaneous spectral components. The initial guess 00063 // of the elements is given in a set of SpectralElements. The final solution 00064 // is returned in the same set. 00065 // 00066 // </synopsis> 00067 // 00068 // <example> 00069 // </example> 00070 // 00071 // <motivation> 00072 // To have a contained fitting of spectral profiles to an observed spectrum 00073 // </motivation> 00074 // 00075 // <todo asof="2001/02/04"> 00076 // <li> add more profile types 00077 // </todo> 00078 00079 class SpectralFit { 00080 public: 00081 00082 //# Constructors 00083 // Default constructor creates a default fitter without elements 00084 SpectralFit(); 00085 // Construct for the given elements 00086 explicit SpectralFit(const SpectralList &in); 00087 // Copy constructor (deep copy) 00088 SpectralFit(const SpectralFit &other); 00089 // Destructor 00090 ~SpectralFit(); 00091 00092 //# Operators 00093 // Assignment (copy semantics) 00094 SpectralFit &operator=(const SpectralFit &other); 00095 00096 //# Member functions 00097 // Set an element to be fitted 00098 // <thrown> 00099 // <li> AipsError if index too large 00100 // </thrown> 00101 void setFitElement(uInt index, const SpectralElement &elem); 00102 00103 // Add elements to be fitted 00104 // <group> 00105 void addFitElement(const SpectralElement &elem); 00106 void addFitElement(const SpectralList &elem); 00107 // </group> 00108 00109 // Clear the list to be fitted (for a re-use of the SpectralFit object) 00110 void clear(); 00111 00112 // Get the list being fitted 00113 const SpectralList &list() const { return slist_p; }; 00114 00115 // Fit the elements as given by the specified spectral elements 00116 // at the frequencies x with values y. Weights of all points are equal. 00117 // The mask (if specified) means: use point if True. Returns 00118 // the convergence status. 00119 // <group> 00120 template <class MT> 00121 Bool fit(const Vector<MT> &y, const Vector<MT> &x) { 00122 return fit(y, x, static_cast<const Vector<Bool> *const>(0)); } 00123 template <class MT> 00124 Bool fit(const Vector<MT> &y, 00125 const Vector<MT> &x, const Vector<Bool> &mask) { 00126 return fit(y, x, &mask); } 00127 // </group> 00128 00129 // Fit the elements as given by the specified spectral elements 00130 // at the frequencies x with values y and weights sigma. 00131 // The mask (if specified) means: use point if True. 00132 // <group> 00133 template <class MT> 00134 Bool fit(const Vector<MT> &sigma, 00135 const Vector<MT> &y, 00136 const Vector<MT> &x) { 00137 return fit(sigma, y, x, static_cast<const Vector<Bool> *const>(0)); } 00138 template <class MT> 00139 Bool fit(const Vector<MT> &sigma, 00140 const Vector<MT> &y, 00141 const Vector<MT> &x, const Vector<Bool> &mask) { 00142 return fit(sigma, y, x, &mask); } 00143 // </group> 00144 00145 // Get the number of iterations last fit 00146 uInt nIterations() const { return iter_p; } 00147 00148 // Get ChiSq of the last fit 00149 Double chiSq () const { return chiSq_p; } 00150 00151 private: 00152 //#Data 00153 // Elements to be fitted 00154 SpectralList slist_p; 00155 // Number of iterations last fit 00156 uInt iter_p; 00157 // ChiSq of last fit 00158 Double chiSq_p; 00159 00160 //# Member functions 00161 // Real fitters 00162 // <group> 00163 template <class MT> 00164 Bool fit(const Vector<MT> &y, 00165 const Vector<MT> &x, 00166 const Vector<Bool> *mask); 00167 template <class MT> 00168 Bool fit(const Vector<MT> &sigma, 00169 const Vector<MT> &y, 00170 const Vector<MT> &x, 00171 const Vector<Bool> *mask); 00172 // </group> 00173 }; 00174 00175 00176 } //# NAMESPACE CASA - END 00177 00178 #ifndef CASACORE_NO_AUTO_TEMPLATES 00179 #include <components/SpectralComponents/SpectralFit2.tcc> 00180 #endif //# CASACORE_NO_AUTO_TEMPLATES 00181 #endif