//# SpectralElement.h: Describes (a set of related) spectral lines //# Copyright (C) 2001,2003,2004 //# Associated Universities, Inc. Washington DC, USA. //# //# This library is free software; you can redistribute it and/or modify it //# under the terms of the GNU Library General Public License as published by //# the Free Software Foundation; either version 2 of the License, or (at your //# option) any later version. //# //# This library is distributed in the hope that it will be useful, but WITHOUT //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public //# License for more details. //# //# You should have received a copy of the GNU Library General Public License //# along with this library; if not, write to the Free Software Foundation, //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. //# //# Correspondence concerning AIPS++ should be addressed as follows: //# Internet email: aips2-request@nrao.edu. //# Postal address: AIPS++ Project Office //# National Radio Astronomy Observatory //# 520 Edgemont Road //# Charlottesville, VA 22903-2475 USA //# //# #ifndef COMPONENTS_GAUSSIANSPECTRALELEMENT_H #define COMPONENTS_GAUSSIANSPECTRALELEMENT_H #include namespace casa { // // Describes a Gaussian spectral line // // // // // //
  • SpectralElement module // // // // From Gaussian and spectral line and element // // // // The GaussianSpectralElement class describes a Gaussian spectral line. // // // // // // // To have a container for data descrbing a Gaussian spectral profile for fitting to an observed spectrum // class GaussianSpectralElement : public PCFSpectralElement { public: // Default constructor creates a default Gaussian element with an amplitude // of 1; an integral (sigma=2sqrt(ln2)/pi) of 1; // a central frequency of zero. It's necessary for this to be public because // Arrays of this class require access to the default constructor. It should never // be used in code developers write though. GaussianSpectralElement(); //# Constants // Sigma to FWHM conversion factor static const casacore::Double SigmaToFWHM; //# Constructors // Construct with given type and values // //
  • AipsError if sigma == 0.0 //
  • AipsError if type not GAUSSIAN // GaussianSpectralElement( const casacore::Double ampl, const casacore::Double center, const casacore::Double sigma ); // Construct the given tp with the given param // //
  • AipsError if incorrect number of parameters (e.g. not 3 for GAUSSIAN) //
  • AipsError if sigma == 0.0 // GaussianSpectralElement(const casacore::Vector ¶m); // Copy constructor (deep copy) // //
  • AipsError if sigma == 0.0 // GaussianSpectralElement(const GaussianSpectralElement &other); //#Destructor // Destructor ~GaussianSpectralElement(); SpectralElement* clone() const; // Assignment (copy semantics) // //
  • AipsError if sigma == 0.0 // // GaussianSpectralElement& operator=(const GaussianSpectralElement &other); // Evaluate the value of the element at x //casacore::Double operator()(const casacore::Double x) const; casacore::Double getSigma() const; casacore::Double getFWHM() const; casacore::Double getSigmaErr() const; casacore::Double getFWHMErr() const; void setSigma(casacore::Double sigma); void setFWHM(casacore::Double fwhm); void fixSigma(const casacore::Bool fix=True); casacore::Bool fixedSigma() const; casacore::Double getIntegral() const; // Save to a record. For Gaussian elements, // the width is defined as a FWHM in the record interface. casacore::Bool toRecord(RecordInterface &out) const; // Sigma to FWHM // Convert from sigma to FWHM and vice versa // static casacore::Double sigmaFromFWHM (const casacore::Double fwhm); static casacore::Double sigmaToFWHM (const casacore::Double sigma); // void set(const casacore::Vector& v); private: // need to overrride SpectralElement::_set() because _param[2] is sigma // but the second param of the corresponding Gaussian1D function is the // FWHM :( void _set(const casacore::Vector& v); }; ostream &operator<<(ostream& os, const GaussianSpectralElement& elem); } //# NAMESPACE CASA - END #endif