LCOV - code coverage report
Current view: top level - components/SpectralComponents - SpectralList.h (source / functions) Hit Total Coverage
Test: ctest_coverage.info Lines: 0 1 0.0 %
Date: 2023-11-02 14:27:30 Functions: 0 1 0.0 %

          Line data    Source code
       1             : //# SpectralList.h: A set of SpectralElements
       2             : //# Copyright (C) 2001
       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             : //# $Id: SpectralList.h 20229 2008-01-29 15:19:06Z gervandiepen $
      28             : 
      29             : #ifndef COMPONENTS_SPECTRALLIST_H
      30             : #define COMPONENTS_SPECTRALLIST_H
      31             : 
      32             : //# Includes
      33             : #include <casacore/casa/aips.h>
      34             : #include <casacore/casa/Containers/Block.h>
      35             : #include <casacore/casa/Arrays/ArrayFwd.h>
      36             : 
      37             : namespace casacore{
      38             : 
      39             : class RecordInterface;
      40             : class String;
      41             : 
      42             : }
      43             : 
      44             : namespace casa { //# NAMESPACE CASA - BEGIN
      45             : 
      46             : //# Forward Declarations
      47             : class SpectralElement;
      48             : 
      49             : // <summary>
      50             : // A set of SpectralElements
      51             : // </summary>
      52             : 
      53             : // <use visibility=export>
      54             : 
      55             : // <reviewed reviewer="" date="yyyy/mm/dd" tests="tSpectralFit" demos="">
      56             : // </reviewed>
      57             : 
      58             : // <prerequisite>
      59             : //   <li> <linkto class=SpectralElement>SpectralElement</linkto> class
      60             : // </prerequisite>
      61             : //
      62             : // <etymology>
      63             : // From spectral line and element list
      64             : // </etymology>
      65             : //
      66             : // <synopsis>
      67             : // The SpectralList class is a container for a set of spectral elements.
      68             : //
      69             : // The list can be used in the
      70             : // <linkto class=SpectralFit>SpectralFit</linkto> class and in the
      71             : // <linkto class=SpectralEstimate>SpectralEstimate</linkto> class.
      72             : //
      73             : // </synopsis>
      74             : //
      75             : // <example>
      76             : // </example>
      77             : //
      78             : // <motivation>
      79             : // To have a container for fitting of spectral profiles to an observed spectrum
      80             : // </motivation>
      81             : //
      82             : // <todo asof="2001/02/04">
      83             : //   <li> add more profile types
      84             : // </todo>
      85             : 
      86             : class SpectralList {
      87             :  public:
      88             : 
      89             :   //# Constructors
      90             :   // Default constructor creates an empty list
      91             :   SpectralList();
      92             :   // Construct a list with a maximum length of n (0: unlimited length)
      93             :   explicit SpectralList(casacore::uInt nmax);
      94             :   // Construct with an initial element
      95             :   explicit SpectralList(const SpectralElement &in);
      96             :   // Copy constructor (deep copy)
      97             :   SpectralList(const SpectralList &other);
      98             : 
      99             :   //#Destructor
     100             :   // Destructor
     101             :   ~SpectralList();
     102             : 
     103             :   //# Operators
     104             :   // Assignment (copy semantics)
     105             :   SpectralList &operator=(const SpectralList &other);
     106             :   // Evaluate the value of the sum of the elements at x
     107             :   casacore::Double operator()(const casacore::Double x) const;
     108             :   // Get element n
     109             :   // <thrown>
     110             :   //  <li> casacore::AipsError if illegal n
     111             :   // </thrown>
     112             :   // <group>
     113             :   const SpectralElement* operator[](const casacore::uInt n) const;
     114             :   SpectralElement* operator[](const casacore::uInt n);
     115             :   // </group>
     116             : 
     117             :   //# Member functions
     118             :   // Get the number of elements in list
     119           0 :   casacore::uInt nelements() const { return list_p.nelements(); };
     120             : 
     121             :   // Get the profile values for all elements in list. The evaluation
     122             :   // is for the length of the given <src>prof</src>, assuming x values of
     123             :   // 0,1,... if no x given.
     124             :   // <group>
     125             :   template <class MT>
     126             :     void evaluate(casacore::Vector<MT> &y) const;
     127             :   template <class MT>
     128             :     void evaluate(casacore::Vector<MT> &y, const casacore::Vector<MT> &x) const;
     129             :    // </group>
     130             : 
     131             :   // Calculate the residuals at the points x; by subtracting the model from y.
     132             :   // x=0,1,2,.. if not given.
     133             :   // <thrown>
     134             :   //  <li> casacore::AipsError if y and x have different lengths
     135             :   // </thrown>
     136             :   // <group>
     137             :   template <class MT>
     138             :     void residual(casacore::Vector<MT> &y) const;
     139             :   template <class MT>
     140             :     void residual(casacore::Vector<MT> &y, const casacore::Vector<MT> &x) const;
     141             :   // </group>
     142             : 
     143             :   // Add elements to list (false if list has max length and full)
     144             :   // <group>
     145             :   casacore::Bool add(const SpectralElement &in);
     146             :   casacore::Bool add(const SpectralList &in);
     147             :   // </group>
     148             :   // Insert in sort order in the list
     149             :   // <group>
     150             :   void insert(const SpectralElement &in);
     151             :   void insert(const SpectralList &in);
     152             :   // </group>
     153             :   // Set an element in the list. Return false if more than one place beyond
     154             :   // end of list; or if beyond max size.
     155             :   casacore::Bool set(const SpectralElement &in, const casacore::uInt which);
     156             : 
     157             :   // Clear the list
     158             :   void clear();
     159             : 
     160             :   // Set a maximum size of the list
     161             :   void set(const casacore::uInt nmax);
     162             : 
     163             :   // casacore::Sort the list on the first parameter (i.e. peak value for Gaussian)
     164             :   void sort();
     165             : 
     166             :   // Convert to and from a casacore::Record (see details in SpectralElement)
     167             :   // <group>
     168             :   casacore::Bool fromRecord (casacore::String& errMsg, const casacore::RecordInterface& container);
     169             :   casacore::Bool toRecord(casacore::RecordInterface& container) const;
     170             :   //</group>
     171             : 
     172             :  private:
     173             :   //#Data
     174             :   // Max length allowed of list
     175             :   casacore::uInt nmax_p;
     176             :   // casacore::List of elements
     177             :   casacore::PtrBlock<SpectralElement *> list_p;
     178             : 
     179             :   //# Member functions
     180             :   // Compare two elements
     181             :   casacore::Int compar(const SpectralElement &p1, const SpectralElement &p2) const;
     182             : 
     183             : };
     184             : 
     185             : //# Global functions
     186             : // <summary> Global functions </summary>
     187             : // <group name=Output>
     188             : // Output declaration
     189             : std::ostream &operator<<(std::ostream &os, const SpectralList &lst);
     190             : // </group>
     191             : 
     192             : 
     193             : } //# NAMESPACE CASA - END
     194             : 
     195             : #ifndef CASACORE_NO_AUTO_TEMPLATES
     196             : #include <components/SpectralComponents/SpectralList2.tcc>
     197             : #endif //# CASACORE_NO_AUTO_TEMPLATES
     198             : #endif

Generated by: LCOV version 1.16