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