LCOV - code coverage report
Current view: top level - synthesis/TransformMachines - PBMath1DCosPoly.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 42 0.0 %
Date: 2024-10-28 15:53:10 Functions: 0 6 0.0 %

          Line data    Source code
       1             : //# PBMath1DCosPoly.cc: Implementation for PBMath1DCosPoly
       2             : //# Copyright (C) 1996,1997,1998,1999,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 adressed 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             : //# $Id$
      28             :  
      29             : #include <casacore/casa/aips.h>
      30             : #include <casacore/casa/BasicSL/Complex.h>
      31             : #include <casacore/casa/BasicMath/Math.h>
      32             : #include <synthesis/TransformMachines/PBMath1DCosPoly.h>
      33             : #include <casacore/casa/Quanta.h>
      34             : #include <casacore/measures/Measures.h>
      35             : #include <casacore/casa/Arrays/ArrayMath.h>
      36             : 
      37             : 
      38             : 
      39             : using namespace casacore;
      40             : namespace casa { //# NAMESPACE CASA - BEGIN
      41             : 
      42           0 : PBMath1DCosPoly::PBMath1DCosPoly(const Vector<Double>& coeff, 
      43             :                                  const Vector<Double>& cosScale,
      44             :                                  Quantity maxRad,
      45             :                                  Quantity refFreq, 
      46             :                                  Bool isThisVP,
      47             :                                  BeamSquint squint,
      48           0 :                                  Bool useSymmetricBeam) :
      49             :   PBMath1D(maxRad, refFreq, isThisVP, squint, useSymmetricBeam),
      50           0 :   coeff_p(coeff),
      51           0 :   cosScale_p(cosScale)
      52             : {
      53           0 :   cosScale_p = cosScale / fScale_p;
      54             :   
      55           0 :   fillPBArray();    
      56             : 
      57           0 :   if (useSymmetricBeam) {
      58           0 :     symmetrizeSquintedBeam();
      59             :   }
      60           0 : };
      61             : 
      62             : 
      63             : 
      64             : 
      65           0 : PBMath1DCosPoly::~PBMath1DCosPoly()
      66             : {
      67           0 : };
      68             : 
      69             : 
      70           0 : PBMath1DCosPoly& PBMath1DCosPoly::operator=(const PBMath1DCosPoly& other)
      71             : {
      72           0 :   if (this == &other)
      73           0 :     return *this;
      74             : 
      75           0 :   PBMath1D::operator=(other);
      76           0 :   coeff_p=other.coeff_p;
      77           0 :   cosScale_p=other.cosScale_p;
      78           0 :   return *this;
      79             : };
      80             : 
      81             : 
      82             : 
      83             : 
      84           0 : void PBMath1DCosPoly::fillPBArray()
      85             : {
      86             : 
      87           0 :   LogIO os(LogOrigin("PBMath1DCosPoly", "fillPBArray"));
      88           0 :   uInt nSamples=10000;
      89           0 :   vp_p.resize(nSamples);
      90             : 
      91           0 :   inverseIncrementRadius_p=Double(nSamples-1)/maximumRadius_p.getValue("'");
      92             :   Double x;
      93             :   Double y;
      94             : 
      95             :   Double VP;
      96             :   //  cout << "Coeff: " << coeff_p << endl;
      97             :   //  cout << "Scaling: " << cosScale_p << endl;
      98             : 
      99             :   uInt k;
     100             :   uInt j;
     101           0 :   for(uInt i=0;i<nSamples;i++) {
     102           0 :     VP = 0.0;    
     103           0 :     for (j=0;j<coeff_p.nelements();j++) {
     104           0 :       x = cos( cosScale_p(j)*Double(i)/inverseIncrementRadius_p );
     105           0 :       if (x != 0) {
     106           0 :         y = 1;
     107           0 :         for (k=0;k<=j;k++) {  // raise x^j power, will handle negatives too
     108           0 :           y *= x;
     109             :         }
     110           0 :         VP +=   coeff_p(j) * y;
     111             :       }
     112             :     }
     113           0 :     if (isThisVP_p) {
     114           0 :       vp_p(i) = VP;
     115             :     } else {
     116           0 :       vp_p(i) = sqrt( VP );
     117             :     }
     118             :   }
     119           0 : };
     120             : 
     121             : 
     122             : //Bool PBMath1DCosPoly::flushToTable(Table& beamSubTable, Int iRow)
     123             : //{};
     124             : 
     125             : void
     126           0 : PBMath1DCosPoly::summary(Int nValues)
     127             : {
     128           0 :   PBMath1D::summary(nValues);
     129           0 :    LogIO os(LogOrigin("PBMath1DCosPoly", "summary"));
     130           0 :    os << "Cosine coefficients: " << coeff_p <<  LogIO::POST;
     131           0 :    os << "Cosine scaling:      " << cosScale_p <<  LogIO::POST;
     132           0 : };
     133             : 
     134             : } //# NAMESPACE CASA - END
     135             : 

Generated by: LCOV version 1.16