Line data Source code
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: casa-feedback@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_LORENTZIANSPECTRALELEMENT_H 29 : #define COMPONENTS_LORENTZIANSPECTRALELEMENT_H 30 : 31 : #include <components/SpectralComponents/PCFSpectralElement.h> 32 : 33 : namespace casa { //# NAMESPACE CASA - BEGIN 34 : 35 : // <summary> 36 : // Describes a single Lorentzian spectral profile 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 Lorentzian and spectral profile and element 50 : // </etymology> 51 : // 52 : // <synopsis> 53 : // The LorentzianSpectralElement class describes a Lorentzian spectral profile. 54 : // </synopsis> 55 : // 56 : // <example> 57 : // </example> 58 : // 59 : // <motivation> 60 : // To have a container for data descrbing a Lorentzian spectral profile for fitting to an observed spectrum 61 : // </motivation> 62 : 63 : class LorentzianSpectralElement : public PCFSpectralElement { 64 : public: 65 : 66 : 67 : 68 : // Construct with given type and values 69 : // <thrown> 70 : // <li> casacore::AipsError if fwhm == 0.0 or amp == 0.0 71 : // </thrown> 72 : LorentzianSpectralElement( 73 : const casacore::Double ampl, const casacore::Double center, 74 : const casacore::Double fwhm 75 : ); 76 : 77 : LorentzianSpectralElement(const casacore::Vector<casacore::Double>& param); 78 : 79 : // Copy constructor (deep copy) 80 : LorentzianSpectralElement(const LorentzianSpectralElement& other); 81 : 82 : ~LorentzianSpectralElement(); 83 : 84 : SpectralElement* clone() const; 85 : 86 : // Assignment (copy semantics) 87 : LorentzianSpectralElement& operator=(const LorentzianSpectralElement& other); 88 : 89 0 : void setFWHM(casacore::Double fwhm) { setWidth(fwhm); } 90 : 91 300 : casacore::Double getFWHM() const { return getWidth(); } 92 : 93 100 : casacore::Double getFWHMErr() const { return getWidthErr(); } 94 : 95 : // get the integral of the function 96 : casacore::Double getIntegral() const; 97 : 98 : private: 99 : // has amp = 1, center = 0, and fwhm = 1 100 : LorentzianSpectralElement(); 101 : 102 : }; 103 : 104 : std::ostream &operator<<(std::ostream& os, const LorentzianSpectralElement& elem); 105 : 106 : } //# NAMESPACE CASA - END 107 : 108 : #endif