PCFSpectralElement.h

Go to the documentation of this file.
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_PCFSPECTRALELEMENT_H
00029 #define COMPONENTS_PCFSPECTRALELEMENT_H
00030 
00031 #include <components/SpectralComponents/SpectralElement.h>
00032 
00033 namespace casa { //# NAMESPACE CASA - BEGIN
00034 
00035 // <summary>
00036 // Abstract base class that describes a spectral profile that can be parameterized
00037 // by a peak value (amplitude), center, and width.
00038 // </summary>
00039 
00040 // <use visibility=export>
00041 
00042 // <reviewed reviewer="" date="yyyy/mm/dd" tests="tSpectralFit" demos="">
00043 // </reviewed>
00044 
00045 // <prerequisite>
00046 //   <li> <linkto module=SpectralElement>SpectralElement</linkto> module
00047 // </prerequisite>
00048 //
00049 // <etymology>
00050 // From p(eak), c(enter), f(whm), and spectral line and element
00051 // </etymology>
00052 //
00053 // <synopsis>
00054 // Abstract base class that describes a spectral profile that can be parameterized
00055 // by a peak value (amplitude), center, and width.
00056 // </synopsis>
00057 //
00058 // <example>
00059 // </example>
00060 //
00061 // <motivation>
00062 // To have a class containing common methods for things like Gaussian, Lorentzian,
00063 // and Voigt profiles.
00064 // </motivation>
00065 
00066 class PCFSpectralElement : public SpectralElement {
00067 public:
00068 
00069         // to help avoid having to hard code parameter indices
00070         enum ParamType {
00071                 AMP,
00072                 CENTER,
00073                 WIDTH
00074         };
00075 
00076         //#Destructor
00077         // Destructor
00078         virtual ~PCFSpectralElement();
00079 
00080 //      PCFSpectralElement& operator=(const PCFSpectralElement &other);
00081 
00082         // Get amplitude
00083         Double getAmpl() const;
00084         // Get center value
00085         Double getCenter() const;
00086         // Get the width
00087         // <group>
00088         virtual Double getWidth() const;
00089 
00090         virtual Double getFWHM() const = 0;
00091 
00092         // get the integral from -inf to inf
00093         virtual Double getIntegral() const = 0;
00094         // </group>
00095         // Get amplitude error estimate
00096         Double getAmplErr() const;
00097         // Get center value error estimate
00098         Double getCenterErr() const;
00099         // Get the width error estimate
00100         // <group>
00101         virtual Double getWidthErr() const;
00102         virtual Double getFWHMErr() const = 0;
00103 
00104 
00105         virtual Double getIntegralErr() const;
00106         // </group>
00107         // Get error estimates of parameters
00108 
00109 
00110         void set(const Vector<Double>& param);
00111 
00112         void setAmpl(const Double ampl);
00113 
00114         void setCenter(const Double center);
00115 
00116         virtual void setWidth(const Double width);
00117 
00118 
00119         void fixAmpl(const Bool fix=True);
00120         void fixCenter(const Bool fix=True);
00121         void fixWidth(const Bool fix=True);
00122         void fixFWHM(const Bool fix=True) { fixWidth(fix); }
00123 
00124         // fix parameters via encoded string. If s contains a, fix amplitude. If s contains f, fix width.
00125         // If s contains c, fix center.
00126         void fixByString(const String& s);
00127         // </group>
00128 
00129 
00130         Bool fixedAmpl() const;
00131         Bool fixedCenter() const;
00132         Bool fixedWidth() const;
00133 
00134         Bool fixedFWHM() const { return fixedWidth(); }
00135 
00136 protected:
00137         PCFSpectralElement(
00138                 SpectralElement::Types type
00139         );
00140 
00141         // param should have three elements: amplitude, center, and width
00142         PCFSpectralElement(
00143                 SpectralElement::Types type, const Vector<Double>& param
00144         );
00145 
00146         PCFSpectralElement(
00147                 SpectralElement::Types type, Double amp,
00148                 Double center, Double width
00149         );
00150 
00151         PCFSpectralElement(const PCFSpectralElement& other);
00152 
00153 
00154 private:
00155         PCFSpectralElement();
00156 
00157         void _initFunction();
00158 
00159 };
00160 
00161 } //# NAMESPACE CASA - END
00162 
00163 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1