casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PCFSpectralElement.h
Go to the documentation of this file.
1 //# SpectralElement.h: Describes (a set of related) spectral lines
2 //# Copyright (C) 2001,2003,2004
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //#
27 
28 #ifndef COMPONENTS_PCFSPECTRALELEMENT_H
29 #define COMPONENTS_PCFSPECTRALELEMENT_H
30 
32 
33 namespace casa { //# NAMESPACE CASA - BEGIN
34 
35 // <summary>
36 // Abstract base class that describes a spectral profile that can be parameterized
37 // by a peak value (amplitude), center, and width.
38 // </summary>
39 
40 // <use visibility=export>
41 
42 // <reviewed reviewer="" date="yyyy/mm/dd" tests="tSpectralFit" demos="">
43 // </reviewed>
44 
45 // <prerequisite>
46 // <li> <linkto module=SpectralElement>SpectralElement</linkto> module
47 // </prerequisite>
48 //
49 // <etymology>
50 // From p(eak), c(enter), f(whm), and spectral line and element
51 // </etymology>
52 //
53 // <synopsis>
54 // Abstract base class that describes a spectral profile that can be parameterized
55 // by a peak value (amplitude), center, and width.
56 // </synopsis>
57 //
58 // <example>
59 // </example>
60 //
61 // <motivation>
62 // To have a class containing common methods for things like Gaussian, Lorentzian,
63 // and Voigt profiles.
64 // </motivation>
65 
67 public:
68 
69  // to help avoid having to hard code parameter indices
70  enum ParamType {
71  AMP,
74  };
75 
76  //#Destructor
77  // Destructor
78  virtual ~PCFSpectralElement();
79 
80 // PCFSpectralElement& operator=(const PCFSpectralElement &other);
81 
82  // Get amplitude
83  casacore::Double getAmpl() const;
84  // Get center value
86  // Get the width
87  // <group>
88  virtual casacore::Double getWidth() const;
89 
90  virtual casacore::Double getFWHM() const = 0;
91 
92  // get the integral from -inf to inf
93  virtual casacore::Double getIntegral() const = 0;
94  // </group>
95  // Get amplitude error estimate
97  // Get center value error estimate
99  // Get the width error estimate
100  // <group>
101  virtual casacore::Double getWidthErr() const;
102  virtual casacore::Double getFWHMErr() const = 0;
103 
104 
105  virtual casacore::Double getIntegralErr() const;
106  // </group>
107  // Get error estimates of parameters
108 
109 
110  void set(const casacore::Vector<casacore::Double>& param);
111 
112  void setAmpl(const casacore::Double ampl);
113 
114  void setCenter(const casacore::Double center);
115 
116  virtual void setWidth(const casacore::Double width);
117 
118 
119  void fixAmpl(const casacore::Bool fix=true);
120  void fixCenter(const casacore::Bool fix=true);
121  void fixWidth(const casacore::Bool fix=true);
122  void fixFWHM(const casacore::Bool fix=true) { fixWidth(fix); }
123 
124  // fix parameters via encoded string. If s contains a, fix amplitude. If s contains f, fix width.
125  // If s contains c, fix center.
126  void fixByString(const casacore::String& s);
127  // </group>
128 
129 
130  casacore::Bool fixedAmpl() const;
131  casacore::Bool fixedCenter() const;
132  casacore::Bool fixedWidth() const;
133 
134  casacore::Bool fixedFWHM() const { return fixedWidth(); }
135 
136 protected:
139  );
140 
141  // param should have three elements: amplitude, center, and width
144  );
145 
148  casacore::Double center, casacore::Double width
149  );
150 
152 
153 
154 private:
156 
157  void _initFunction();
158 
159 };
160 
161 } //# NAMESPACE CASA - END
162 
163 #endif
casacore::Bool fixedFWHM() const
virtual casacore::Double getFWHM() const =0
void setAmpl(const casacore::Double ampl)
void set(const casacore::Vector< casacore::Double > &param)
Get error estimates of parameters.
casacore::Double getCenterErr() const
Get center value error estimate.
void fixCenter(const casacore::Bool fix=true)
void fixAmpl(const casacore::Bool fix=true)
virtual Type type()
Return the type enum.
virtual casacore::Double getFWHMErr() const =0
virtual casacore::Double getWidth() const
Get the width.
virtual casacore::Double getIntegralErr() const
virtual ~PCFSpectralElement()
Destructor.
casacore::Double getAmplErr() const
Get amplitude error estimate.
virtual void setWidth(const casacore::Double width)
Describes (a set of related) spectral lines.
casacore::Bool fixedCenter() const
casacore::Bool fixedWidth() const
double Double
Definition: aipstype.h:55
virtual void fix(const casacore::Vector< casacore::Bool > &fix)
Set fixed parameters (true) or unset them (false)
Abstract base class that describes a spectral profile that can be parameterized by a peak value (ampl...
virtual casacore::Double getIntegral() const =0
get the integral from -inf to inf
void fixWidth(const casacore::Bool fix=true)
LatticeExprNode amp(const LatticeExprNode &left, const LatticeExprNode &right)
This function finds sqrt(left^2+right^2).
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual casacore::Double getWidthErr() const
Get the width error estimate.
casacore::Bool fixedAmpl() const
void _initFunction()
String: the storage and methods of handling collections of characters.
Definition: String.h:223
PCFSpectralElement(SpectralElement::Types type)
ParamType
to help avoid having to hard code parameter indices
Types
Supported spectral components.
casacore::Double getCenter() const
Get center value.
casacore::Double getAmpl() const
PCFSpectralElement&amp; operator=(const PCFSpectralElement &amp;other);.
void setCenter(const casacore::Double center)
void fixFWHM(const casacore::Bool fix=true)
void fixByString(const casacore::String &s)
fix parameters via encoded string.