source: trunk/external-alma/components/SpectralComponents/PCFSpectralElement.h@ 2987

Last change on this file since 2987 was 2980, checked in by Malte Marquarding, 10 years ago

Add a copy of casacore/components/SpectralComponents to external-alma directory to prepare for its removal from casacore-trunk. DOn;t activate in SConscript yet.

File size: 4.2 KB
Line 
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
31#include <components/SpectralComponents/SpectralElement.h>
32
33namespace 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 class=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
66class PCFSpectralElement : public SpectralElement {
67public:
68
69 // to help avoid having to hard code parameter indices
70 enum ParamType {
71 AMP,
72 CENTER,
73 WIDTH
74 };
75
76 //#Destructor
77 // Destructor
78 virtual ~PCFSpectralElement();
79
80// PCFSpectralElement& operator=(const PCFSpectralElement &other);
81
82 // Get amplitude
83 Double getAmpl() const;
84 // Get center value
85 Double getCenter() const;
86 // Get the width
87 // <group>
88 virtual Double getWidth() const;
89
90 virtual Double getFWHM() const = 0;
91
92 // get the integral from -inf to inf
93 virtual Double getIntegral() const = 0;
94 // </group>
95 // Get amplitude error estimate
96 Double getAmplErr() const;
97 // Get center value error estimate
98 Double getCenterErr() const;
99 // Get the width error estimate
100 // <group>
101 virtual Double getWidthErr() const;
102 virtual Double getFWHMErr() const = 0;
103
104
105 virtual Double getIntegralErr() const;
106 // </group>
107 // Get error estimates of parameters
108
109
110 void set(const Vector<Double>& param);
111
112 void setAmpl(const Double ampl);
113
114 void setCenter(const Double center);
115
116 virtual void setWidth(const Double width);
117
118
119 void fixAmpl(const Bool fix=True);
120 void fixCenter(const Bool fix=True);
121 void fixWidth(const Bool fix=True);
122 void fixFWHM(const 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 String& s);
127 // </group>
128
129
130 Bool fixedAmpl() const;
131 Bool fixedCenter() const;
132 Bool fixedWidth() const;
133
134 Bool fixedFWHM() const { return fixedWidth(); }
135
136protected:
137 PCFSpectralElement(
138 SpectralElement::Types type
139 );
140
141 // param should have three elements: amplitude, center, and width
142 PCFSpectralElement(
143 SpectralElement::Types type, const Vector<Double>& param
144 );
145
146 PCFSpectralElement(
147 SpectralElement::Types type, Double amp,
148 Double center, Double width
149 );
150
151 PCFSpectralElement(const PCFSpectralElement& other);
152
153
154private:
155 PCFSpectralElement();
156
157 void _initFunction();
158
159};
160
161} //# NAMESPACE CASA - END
162
163#endif
Note: See TracBrowser for help on using the repository browser.