casa
$Rev:20696$
|
00001 //# SpectralElement.h: Describes (a set of related) spectral lines 00002 //# Copyright (C) 2001,2003,2004 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 00028 #ifndef COMPONENTS_GAUSSIANSPECTRALELEMENT_H 00029 #define COMPONENTS_GAUSSIANSPECTRALELEMENT_H 00030 00031 #include <components/SpectralComponents/PCFSpectralElement.h> 00032 00033 namespace casa { //# NAMESPACE CASA - BEGIN 00034 00035 // <summary> 00036 // Describes a Gaussian spectral line 00037 // </summary> 00038 00039 // <use visibility=export> 00040 00041 // <reviewed reviewer="" date="yyyy/mm/dd" tests="tSpectralFit" demos=""> 00042 // </reviewed> 00043 00044 // <prerequisite> 00045 // <li> <linkto module=SpectralElement>SpectralElement</linkto> module 00046 // </prerequisite> 00047 // 00048 // <etymology> 00049 // From Gaussian and spectral line and element 00050 // </etymology> 00051 // 00052 // <synopsis> 00053 // The GaussianSpectralElement class describes a Gaussian spectral line. 00054 00055 // </synopsis> 00056 // 00057 // <example> 00058 // </example> 00059 // 00060 // <motivation> 00061 // To have a container for data descrbing a Gaussian spectral profile for fitting to an observed spectrum 00062 // </motivation> 00063 00064 class GaussianSpectralElement : public PCFSpectralElement { 00065 public: 00066 00067 //# Constants 00068 // Sigma to FWHM conversion factor 00069 static const Double SigmaToFWHM; 00070 00071 //# Constructors 00072 // Default constructor creates a default Gaussian element with an amplitude 00073 // of 1; an integral <src>(sigma=2sqrt(ln2)/pi)</src> of 1; 00074 // a central frequency of zero. 00075 GaussianSpectralElement(); 00076 // Construct with given type and values 00077 // <thrown> 00078 // <li> AipsError if sigma == 0.0 00079 // <li> AipsError if type not GAUSSIAN 00080 // </thrown> 00081 GaussianSpectralElement( 00082 const Double ampl, const Double center, 00083 const Double sigma 00084 ); 00085 00086 // Construct the given tp with the given param 00087 // <thrown> 00088 // <li> AipsError if incorrect number of parameters (e.g. not 3 for GAUSSIAN) 00089 // <li> AipsError if sigma == 0.0 00090 // </thrown> 00091 GaussianSpectralElement(const Vector<Double> ¶m); 00092 // Copy constructor (deep copy) 00093 // <thrown> 00094 // <li> AipsError if sigma == 0.0 00095 // </thrown> 00096 GaussianSpectralElement(const GaussianSpectralElement &other); 00097 00098 //#Destructor 00099 // Destructor 00100 ~GaussianSpectralElement(); 00101 00102 SpectralElement* clone() const; 00103 00104 // Assignment (copy semantics) 00105 // <thrown> 00106 // <li> AipsError if sigma == 0.0 00107 // </thrown> 00108 GaussianSpectralElement& operator=(const GaussianSpectralElement &other); 00109 // Evaluate the value of the element at x 00110 Double operator()(const Double x) const; 00111 00112 Double getSigma() const; 00113 Double getFWHM() const; 00114 00115 Double getSigmaErr() const; 00116 Double getFWHMErr() const; 00117 00118 00119 void setSigma(Double sigma); 00120 void setFWHM(Double fwhm); 00121 00122 void fixSigma(const Bool fix=True); 00123 00124 Bool fixedSigma() const; 00125 00126 Double getIntegral() const; 00127 00128 // Save to a record. For Gaussian elements, 00129 // the width is defined as a FWHM in the record interface. 00130 Bool toRecord(RecordInterface &out) const; 00131 00132 // Sigma to FWHM 00133 // Convert from sigma to FWHM and vice versa 00134 // <group> 00135 static Double sigmaFromFWHM (const Double fwhm); 00136 00137 static Double sigmaToFWHM (const Double sigma); 00138 // </group> 00139 00140 }; 00141 00142 ostream &operator<<(ostream& os, const GaussianSpectralElement& elem); 00143 00144 00145 } //# NAMESPACE CASA - END 00146 00147 #endif