LCOV - code coverage report
Current view: top level - components/ComponentModels - ConstantSpectrum.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 50 68 73.5 %
Date: 2024-10-12 00:35:29 Functions: 15 20 75.0 %

          Line data    Source code
       1             : //# ConstantSpectrum.cc.cc:
       2             : //# Copyright (C) 1998,1999,2000,2003
       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             : //# $Id: ConstantSpectrum.cc 20652 2009-07-06 05:04:32Z Malte.Marquarding $
      27             : 
      28             : #include <components/ComponentModels/ConstantSpectrum.h>
      29             : #include <casacore/casa/Arrays/Vector.h>
      30             : #include <casacore/casa/Exceptions/Error.h>
      31             : #include <casacore/casa/Containers/RecordInterface.h>
      32             : #include <casacore/casa/Quanta/Quantum.h>
      33             : #include <casacore/casa/Utilities/Assert.h>
      34             : #include <casacore/casa/BasicSL/String.h>
      35             : 
      36             : using namespace casacore;
      37             : namespace casa { //# NAMESPACE CASA - BEGIN
      38             : 
      39       57557 : ConstantSpectrum::ConstantSpectrum()
      40       57557 :   :SpectralModel()
      41             : {
      42       57557 :   DebugAssert(ok(), AipsError);
      43       57557 : }
      44             : 
      45          30 : ConstantSpectrum::ConstantSpectrum(const ConstantSpectrum& other) 
      46          30 :   :SpectralModel(other)
      47             : {
      48          30 :   DebugAssert(ok(), AipsError);
      49          30 : }
      50             : 
      51      115166 : ConstantSpectrum::~ConstantSpectrum() {
      52       57586 :   DebugAssert(ok(), AipsError);
      53      115166 : }
      54             : 
      55           0 : ConstantSpectrum& ConstantSpectrum::operator=(const ConstantSpectrum& other) {
      56           0 :   SpectralModel::operator=(other);
      57           0 :   DebugAssert(ok(), AipsError);
      58           0 :   return *this;
      59             : }
      60             : 
      61       31404 : ComponentType::SpectralShape ConstantSpectrum::type() const {
      62       31404 :   DebugAssert(ok(), AipsError);
      63       31404 :   return ComponentType::CONSTANT_SPECTRUM;
      64             : }
      65             : 
      66           0 : Double ConstantSpectrum::sample(const MFrequency&) const {
      67           0 :   DebugAssert(ok(), AipsError);
      68           0 :   return 1.0;
      69             : }
      70             : 
      71           0 : void ConstantSpectrum::sampleStokes(const MFrequency&, Vector<Double>& iquv) const {
      72           0 :   DebugAssert(ok(), AipsError);
      73           0 :   if(iquv.nelements() != 4 ){//keeps compiler happy
      74             :     };
      75             :     
      76             :     
      77           0 : }
      78             : 
      79           0 : void ConstantSpectrum::sample(Vector<Double>& scale, 
      80             :                               const Vector<MFrequency::MVType>&, 
      81             :                               const MFrequency::Ref&) const {
      82           0 :   DebugAssert(ok(), AipsError);
      83           0 :   scale = 1.0;
      84           0 : }
      85             : 
      86       27520 : void ConstantSpectrum::sampleStokes(
      87             :     Matrix<Double>& iquv, const Vector<MFrequency::MVType>& freq, 
      88             :     const MFrequency::Ref&
      89             : ) const {
      90       27520 :     ThrowIf(iquv.shape() != IPosition(2, freq.size(), 4), "Incorrect Matrix shape");
      91       27520 : }
      92             : 
      93          30 : SpectralModel* ConstantSpectrum::clone() const {
      94          30 :   DebugAssert(ok(), AipsError);
      95          30 :   SpectralModel* tmpPtr = new ConstantSpectrum(*this);
      96          30 :   AlwaysAssert(tmpPtr != 0, AipsError);
      97          30 :   return tmpPtr;
      98             : }
      99             : 
     100           5 : uInt ConstantSpectrum::nParameters() const {
     101           5 :   DebugAssert(ok(), AipsError);
     102           5 :   return 0;
     103             : }
     104             : 
     105           5 : void ConstantSpectrum::setParameters(const Vector<Double>& newSpectralParms) {
     106           5 :   DebugAssert(newSpectralParms.nelements() == nParameters(), AipsError);
     107           5 :   DebugAssert(ok(), AipsError);
     108             :   // Suppress compiler warning about unused variable
     109             :   // perhaps should just get rid of the DebugAssert statements
     110           5 :   if (newSpectralParms.empty()) {}; 
     111           5 : }
     112             : 
     113           5 : Vector<Double> ConstantSpectrum::parameters() const {
     114           5 :   DebugAssert(ok(), AipsError);
     115           5 :   return Vector<Double>(0);
     116             : }
     117             : 
     118           5 : void ConstantSpectrum::setErrors(const Vector<Double>& newSpectralErrs) {
     119           5 :   DebugAssert(ok(), AipsError);
     120             :   // Suppress compiler warning about unused variable
     121           5 :   if (newSpectralErrs.empty()) {}; 
     122           5 : }
     123             : 
     124           5 : Vector<Double> ConstantSpectrum::errors() const {
     125           5 :   DebugAssert(ok(), AipsError);
     126           5 :   Vector<Double> tmp(1,0.0);
     127           5 :   return tmp;
     128             : }
     129             : 
     130       27528 : Bool ConstantSpectrum::fromRecord(String& errorMessage, 
     131             :                                   const RecordInterface& record) {
     132       27528 :   const Bool retVal = SpectralModel::fromRecord(errorMessage, record);
     133       27528 :   DebugAssert(ok(), AipsError);
     134       27528 :   return retVal;
     135             : }
     136             : 
     137         868 : Bool ConstantSpectrum::toRecord(String& errorMessage,
     138             :                                 RecordInterface& record) const {
     139         868 :   DebugAssert(ok(), AipsError);
     140         868 :   return SpectralModel::toRecord(errorMessage, record);
     141             : }
     142             : 
     143           0 : Bool ConstantSpectrum::convertUnit(String&,
     144             :                                    const RecordInterface&) {
     145           0 :   DebugAssert(ok(), AipsError);
     146           0 :   return true;
     147             : }
     148             :  
     149      232609 : Bool ConstantSpectrum::ok() const {
     150      232609 :   return SpectralModel::ok();
     151             : }
     152             : // Local Variables: 
     153             : // compile-command: "gmake OPTLIB=1 ConstantSpectrum"
     154             : // End:
     155             : 
     156             : } //# NAMESPACE CASA - END
     157             : 

Generated by: LCOV version 1.16