LCOV - code coverage report
Current view: top level - components/SpectralComponents - PCFSpectralElement.h (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 1 0.0 %
Date: 2024-11-06 17:42:47 Functions: 0 1 0.0 %

          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_PCFSPECTRALELEMENT_H
      29             : #define COMPONENTS_PCFSPECTRALELEMENT_H
      30             : 
      31             : #include <components/SpectralComponents/SpectralElement.h>
      32             : 
      33             : namespace casa { //# NAMESPACE CASA - BEGIN
      34             : 
      35             : // <summary>
      36             : // Abstract base class that describes a spectral profile that can be parameterized
      37             : // by a peak value (amplitude), center, and width.
      38             : // </summary>
      39             : 
      40             : // <use visibility=export>
      41             : 
      42             : // <reviewed reviewer="" date="yyyy/mm/dd" tests="tSpectralFit" demos="">
      43             : // </reviewed>
      44             : 
      45             : // <prerequisite>
      46             : //   <li> <linkto module=SpectralElement>SpectralElement</linkto> module
      47             : // </prerequisite>
      48             : //
      49             : // <etymology>
      50             : // From p(eak), c(enter), f(whm), and spectral line and element
      51             : // </etymology>
      52             : //
      53             : // <synopsis>
      54             : // Abstract base class that describes a spectral profile that can be parameterized
      55             : // by a peak value (amplitude), center, and width.
      56             : // </synopsis>
      57             : //
      58             : // <example>
      59             : // </example>
      60             : //
      61             : // <motivation>
      62             : // To have a class containing common methods for things like Gaussian, Lorentzian,
      63             : // and Voigt profiles.
      64             : // </motivation>
      65             : 
      66             : class PCFSpectralElement : public SpectralElement {
      67             : public:
      68             : 
      69             :         // to help avoid having to hard code parameter indices
      70             :         enum ParamType {
      71             :                 AMP,
      72             :                 CENTER,
      73             :                 WIDTH
      74             :         };
      75             : 
      76             :         //#Destructor
      77             :         // Destructor
      78             :         virtual ~PCFSpectralElement();
      79             : 
      80             : //      PCFSpectralElement& operator=(const PCFSpectralElement &other);
      81             : 
      82             :         // Get amplitude
      83             :         casacore::Double getAmpl() const;
      84             :         // Get center value
      85             :         casacore::Double getCenter() const;
      86             :         // Get the width
      87             :         // <group>
      88             :         virtual casacore::Double getWidth() const;
      89             : 
      90             :         virtual casacore::Double getFWHM() const = 0;
      91             : 
      92             :         // get the integral from -inf to inf
      93             :         virtual casacore::Double getIntegral() const = 0;
      94             :         // </group>
      95             :         // Get amplitude error estimate
      96             :         casacore::Double getAmplErr() const;
      97             :         // Get center value error estimate
      98             :         casacore::Double getCenterErr() const;
      99             :         // Get the width error estimate
     100             :         // <group>
     101             :         virtual casacore::Double getWidthErr() const;
     102             :         virtual casacore::Double getFWHMErr() const = 0;
     103             : 
     104             : 
     105             :         virtual casacore::Double getIntegralErr() const;
     106             :         // </group>
     107             :         // Get error estimates of parameters
     108             : 
     109             : 
     110             :         void set(const casacore::Vector<casacore::Double>& param);
     111             : 
     112             :         void setAmpl(const casacore::Double ampl);
     113             : 
     114             :         void setCenter(const casacore::Double center);
     115             : 
     116             :         virtual void setWidth(const casacore::Double width);
     117             : 
     118             : 
     119             :         void fixAmpl(const casacore::Bool fix=true);
     120             :         void fixCenter(const casacore::Bool fix=true);
     121             :         void fixWidth(const casacore::Bool fix=true);
     122             :         void fixFWHM(const casacore::Bool fix=true) { fixWidth(fix); }
     123             : 
     124             :         // fix parameters via encoded string. If s contains a, fix amplitude. If s contains f, fix width.
     125             :         // If s contains c, fix center.
     126             :         void fixByString(const casacore::String& s);
     127             :         // </group>
     128             : 
     129             : 
     130             :         casacore::Bool fixedAmpl() const;
     131             :         casacore::Bool fixedCenter() const;
     132             :         casacore::Bool fixedWidth() const;
     133             : 
     134           0 :         casacore::Bool fixedFWHM() const { return fixedWidth(); }
     135             : 
     136             : protected:
     137             :         PCFSpectralElement(
     138             :                 SpectralElement::Types type
     139             :         );
     140             : 
     141             :         // param should have three elements: amplitude, center, and width
     142             :         PCFSpectralElement(
     143             :                 SpectralElement::Types type, const casacore::Vector<casacore::Double>& param
     144             :         );
     145             : 
     146             :         PCFSpectralElement(
     147             :                 SpectralElement::Types type, casacore::Double amp,
     148             :                 casacore::Double center, casacore::Double width
     149             :         );
     150             : 
     151             :         PCFSpectralElement(const PCFSpectralElement& other);
     152             : 
     153             : 
     154             : private:
     155             :         PCFSpectralElement();
     156             : 
     157             :         void _initFunction();
     158             : 
     159             : };
     160             : 
     161             : } //# NAMESPACE CASA - END
     162             : 
     163             : #endif

Generated by: LCOV version 1.16