source: trunk/external-alma/components/SpectralComponents/GaussianSpectralElement.h@ 3058

Last change on this file since 3058 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.5 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_GAUSSIANSPECTRALELEMENT_H
29#define COMPONENTS_GAUSSIANSPECTRALELEMENT_H
30
31#include <components/SpectralComponents/PCFSpectralElement.h>
32
33namespace casa {
34
35// <summary>
36// Describes a Gaussian spectral line
37// </summary>
38
39// <use visibility=export>
40
41// <reviewed reviewer="" date="yyyy/mm/dd" tests="tSpectralFit" demos="">
42// </reviewed>
43
44// <prerequisite>
45// <li> <linkto class=SpectralElement>SpectralElement</linkto> module
46// </prerequisite>
47//
48// <etymology>
49// From Gaussian and spectral line and element
50// </etymology>
51//
52// <synopsis>
53// The GaussianSpectralElement class describes a Gaussian spectral line.
54
55// </synopsis>
56//
57// <example>
58// </example>
59//
60// <motivation>
61// To have a container for data descrbing a Gaussian spectral profile for fitting to an observed spectrum
62// </motivation>
63
64class GaussianSpectralElement : public PCFSpectralElement {
65
66public:
67
68 // Default constructor creates a default Gaussian element with an amplitude
69 // of 1; an integral <src>(sigma=2sqrt(ln2)/pi)</src> of 1;
70 // a central frequency of zero. It's necessary for this to be public because
71 // Arrays of this class require access to the default constructor. It should never
72 // be used in code developers write though.
73 GaussianSpectralElement();
74
75
76 //# Constants
77 // Sigma to FWHM conversion factor
78 static const Double SigmaToFWHM;
79
80 //# Constructors
81
82 // Construct with given type and values
83 // <thrown>
84 // <li> AipsError if sigma == 0.0
85 // <li> AipsError if type not GAUSSIAN
86 // </thrown>
87 GaussianSpectralElement(
88 const Double ampl, const Double center,
89 const Double sigma
90 );
91
92 // Construct the given tp with the given param
93 // <thrown>
94 // <li> AipsError if incorrect number of parameters (e.g. not 3 for GAUSSIAN)
95 // <li> AipsError if sigma == 0.0
96 // </thrown>
97 GaussianSpectralElement(const Vector<Double> &param);
98 // Copy constructor (deep copy)
99 // <thrown>
100 // <li> AipsError if sigma == 0.0
101 // </thrown>
102 GaussianSpectralElement(const GaussianSpectralElement &other);
103
104 //#Destructor
105 // Destructor
106 ~GaussianSpectralElement();
107
108 SpectralElement* clone() const;
109
110 // Assignment (copy semantics)
111 // <thrown>
112 // <li> AipsError if sigma == 0.0
113 // </thrown>
114// GaussianSpectralElement& operator=(const GaussianSpectralElement &other);
115 // Evaluate the value of the element at x
116 //Double operator()(const Double x) const;
117
118 Double getSigma() const;
119 Double getFWHM() const;
120
121 Double getSigmaErr() const;
122 Double getFWHMErr() const;
123
124
125 void setSigma(Double sigma);
126 void setFWHM(Double fwhm);
127
128 void fixSigma(const Bool fix=True);
129
130 Bool fixedSigma() const;
131
132 Double getIntegral() const;
133
134 // Save to a record. For Gaussian elements,
135 // the width is defined as a FWHM in the record interface.
136 Bool toRecord(RecordInterface &out) const;
137
138 // Sigma to FWHM
139 // Convert from sigma to FWHM and vice versa
140 // <group>
141 static Double sigmaFromFWHM (const Double fwhm);
142
143 static Double sigmaToFWHM (const Double sigma);
144 // </group>
145
146 void set(const Vector<Double>& v);
147
148private:
149 // need to overrride SpectralElement::_set() because _param[2] is sigma
150 // but the second param of the corresponding Gaussian1D function is the
151 // FWHM :(
152 void _set(const Vector<Double>& v);
153
154};
155
156ostream &operator<<(ostream& os, const GaussianSpectralElement& elem);
157
158
159} //# NAMESPACE CASA - END
160
161#endif
Note: See TracBrowser for help on using the repository browser.