casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GaussianSpectralElement.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_GAUSSIANSPECTRALELEMENT_H
29 #define COMPONENTS_GAUSSIANSPECTRALELEMENT_H
30 
32 
33 namespace 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 module=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 
65 
66 public:
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.
74 
75 
76  //# Constants
77  // Sigma to FWHM conversion factor
79 
80  //# Constructors
81 
82  // Construct with given type and values
83  // <thrown>
84  // <li> casacore::AipsError if sigma == 0.0
85  // <li> casacore::AipsError if type not GAUSSIAN
86  // </thrown>
88  const casacore::Double ampl, const casacore::Double center,
89  const casacore::Double sigma
90  );
91 
92  // Construct the given tp with the given param
93  // <thrown>
94  // <li> casacore::AipsError if incorrect number of parameters (e.g. not 3 for GAUSSIAN)
95  // <li> casacore::AipsError if sigma == 0.0
96  // </thrown>
98  // Copy constructor (deep copy)
99  // <thrown>
100  // <li> casacore::AipsError if sigma == 0.0
101  // </thrown>
103 
104  //#Destructor
105  // Destructor
107 
108  SpectralElement* clone() const;
109 
110  // Assignment (copy semantics)
111  // <thrown>
112  // <li> casacore::AipsError if sigma == 0.0
113  // </thrown>
114 // GaussianSpectralElement& operator=(const GaussianSpectralElement &other);
115  // Evaluate the value of the element at x
116  //casacore::Double operator()(const casacore::Double x) const;
117 
118  casacore::Double getSigma() const;
119  casacore::Double getFWHM() const;
120 
123 
124 
125  void setSigma(casacore::Double sigma);
126  void setFWHM(casacore::Double fwhm);
127 
128  void fixSigma(const casacore::Bool fix=true);
129 
130  casacore::Bool fixedSigma() const;
131 
133 
134  // Save to a record. For Gaussian elements,
135  // the width is defined as a FWHM in the record interface.
137 
138  // Sigma to FWHM
139  // Convert from sigma to FWHM and vice versa
140  // <group>
141  static casacore::Double sigmaFromFWHM (const casacore::Double fwhm);
142 
143  static casacore::Double sigmaToFWHM (const casacore::Double sigma);
144  // </group>
145 
147 
148 private:
149  // need to overrride SpectralElement::_set() because _param[2] is sigma
150  // but the second param of the corresponding casacore::Gaussian1D function is the
151  // FWHM :(
153 
154 };
155 
156 std::ostream &operator<<(std::ostream& os, const GaussianSpectralElement& elem);
157 
158 
159 } //# NAMESPACE CASA - END
160 
161 #endif
casacore::Double getSigmaErr() const
static casacore::Double sigmaFromFWHM(const casacore::Double fwhm)
Sigma to FWHM Convert from sigma to FWHM and vice versa.
ostream & operator<<(ostream &os, const PageHeaderCache &cache)
~GaussianSpectralElement()
Destructor.
casacore::Bool toRecord(casacore::RecordInterface &out) const
Save to a record.
void setFWHM(casacore::Double fwhm)
casacore::Double getSigma() const
Assignment (copy semantics)
SpectralElement * clone() const
Describes (a set of related) spectral lines.
casacore::Double getFWHM() const
static casacore::Double sigmaToFWHM(const casacore::Double sigma)
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...
void set(const casacore::Vector< casacore::Double > &v)
Get error estimates of parameters.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
casacore::Double getFWHMErr() const
casacore::Bool fixedSigma() const
static const casacore::Double SigmaToFWHM
Sigma to FWHM conversion factor.
casacore::Double getIntegral() const
get the integral from -inf to inf
GaussianSpectralElement()
Default constructor creates a default Gaussian element with an amplitude of 1; an integral (sigma=2sq...
Abstract base class for Record classes.
void setSigma(casacore::Double sigma)
void fixSigma(const casacore::Bool fix=true)
Describes a Gaussian spectral line.
void _set(const casacore::Vector< casacore::Double > &v)
need to overrride SpectralElement::_set() because _param[2] is sigma but the second param of the corr...