LCOV - code coverage report
Current view: top level - components/ComponentModels - ConstantSpectrum.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 31 68 45.6 %
Date: 2024-10-29 13:38:20 Functions: 10 20 50.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       51206 : ConstantSpectrum::ConstantSpectrum()
      40       51206 :   :SpectralModel()
      41             : {
      42       51206 :   DebugAssert(ok(), AipsError);
      43       51206 : }
      44             : 
      45           1 : ConstantSpectrum::ConstantSpectrum(const ConstantSpectrum& other) 
      46           1 :   :SpectralModel(other)
      47             : {
      48           1 :   DebugAssert(ok(), AipsError);
      49           1 : }
      50             : 
      51      102411 : ConstantSpectrum::~ConstantSpectrum() {
      52       51206 :   DebugAssert(ok(), AipsError);
      53      102411 : }
      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       26400 : ComponentType::SpectralShape ConstantSpectrum::type() const {
      62       26400 :   DebugAssert(ok(), AipsError);
      63       26400 :   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       25600 : void ConstantSpectrum::sampleStokes(
      87             :     Matrix<Double>& iquv, const Vector<MFrequency::MVType>& freq, 
      88             :     const MFrequency::Ref&
      89             : ) const {
      90       25600 :     ThrowIf(iquv.shape() != IPosition(2, freq.size(), 4), "Incorrect Matrix shape");
      91       25600 : }
      92             : 
      93           1 : SpectralModel* ConstantSpectrum::clone() const {
      94           1 :   DebugAssert(ok(), AipsError);
      95           1 :   SpectralModel* tmpPtr = new ConstantSpectrum(*this);
      96           1 :   AlwaysAssert(tmpPtr != 0, AipsError);
      97           1 :   return tmpPtr;
      98             : }
      99             : 
     100           0 : uInt ConstantSpectrum::nParameters() const {
     101           0 :   DebugAssert(ok(), AipsError);
     102           0 :   return 0;
     103             : }
     104             : 
     105           0 : void ConstantSpectrum::setParameters(const Vector<Double>& newSpectralParms) {
     106           0 :   DebugAssert(newSpectralParms.nelements() == nParameters(), AipsError);
     107           0 :   DebugAssert(ok(), AipsError);
     108             :   // Suppress compiler warning about unused variable
     109             :   // perhaps should just get rid of the DebugAssert statements
     110           0 :   if (newSpectralParms.empty()) {}; 
     111           0 : }
     112             : 
     113           0 : Vector<Double> ConstantSpectrum::parameters() const {
     114           0 :   DebugAssert(ok(), AipsError);
     115           0 :   return Vector<Double>(0);
     116             : }
     117             : 
     118           0 : void ConstantSpectrum::setErrors(const Vector<Double>& newSpectralErrs) {
     119           0 :   DebugAssert(ok(), AipsError);
     120             :   // Suppress compiler warning about unused variable
     121           0 :   if (newSpectralErrs.empty()) {}; 
     122           0 : }
     123             : 
     124           0 : Vector<Double> ConstantSpectrum::errors() const {
     125           0 :   DebugAssert(ok(), AipsError);
     126           0 :   Vector<Double> tmp(1,0.0);
     127           0 :   return tmp;
     128             : }
     129             : 
     130       25600 : Bool ConstantSpectrum::fromRecord(String& errorMessage, 
     131             :                                   const RecordInterface& record) {
     132       25600 :   const Bool retVal = SpectralModel::fromRecord(errorMessage, record);
     133       25600 :   DebugAssert(ok(), AipsError);
     134       25600 :   return retVal;
     135             : }
     136             : 
     137         800 : Bool ConstantSpectrum::toRecord(String& errorMessage,
     138             :                                 RecordInterface& record) const {
     139         800 :   DebugAssert(ok(), AipsError);
     140         800 :   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      206420 : Bool ConstantSpectrum::ok() const {
     150      206420 :   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