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

Last change on this file since 3118 was 3106, checked in by Takeshi Nakazato, 8 years ago

New Development: No

JIRA Issue: No

Ready for Test: Yes/No

Interface Changes: Yes/No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No

Module(s): Module Names change impacts.

Description: Describe your changes here...


Check-in asap modifications from Jim regarding casacore namespace conversion.

File size: 4.7 KB
RevLine 
[2980]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
[3106]78 static const casacore::Double SigmaToFWHM;
[2980]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(
[3106]88 const casacore::Double ampl, const casacore::Double center,
89 const casacore::Double sigma
[2980]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>
[3106]97 GaussianSpectralElement(const casacore::Vector<casacore::Double> &param);
[2980]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
[3106]116 //casacore::Double operator()(const casacore::Double x) const;
[2980]117
[3106]118 casacore::Double getSigma() const;
119 casacore::Double getFWHM() const;
[2980]120
[3106]121 casacore::Double getSigmaErr() const;
122 casacore::Double getFWHMErr() const;
[2980]123
124
[3106]125 void setSigma(casacore::Double sigma);
126 void setFWHM(casacore::Double fwhm);
[2980]127
[3106]128 void fixSigma(const casacore::Bool fix=True);
[2980]129
[3106]130 casacore::Bool fixedSigma() const;
[2980]131
[3106]132 casacore::Double getIntegral() const;
[2980]133
134 // Save to a record. For Gaussian elements,
135 // the width is defined as a FWHM in the record interface.
[3106]136 casacore::Bool toRecord(RecordInterface &out) const;
[2980]137
138 // Sigma to FWHM
139 // Convert from sigma to FWHM and vice versa
140 // <group>
[3106]141 static casacore::Double sigmaFromFWHM (const casacore::Double fwhm);
[2980]142
[3106]143 static casacore::Double sigmaToFWHM (const casacore::Double sigma);
[2980]144 // </group>
145
[3106]146 void set(const casacore::Vector<casacore::Double>& v);
[2980]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 :(
[3106]152 void _set(const casacore::Vector<casacore::Double>& v);
[2980]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.