LCOV - code coverage report
Current view: top level - synthesis/TransformMachines - PBMath1DGauss.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 34 0.0 %
Date: 2024-12-11 20:54:31 Functions: 0 6 0.0 %

          Line data    Source code
       1             : //# PBMath1DGauss.cc: Implementation for PBMath1DGauss
       2             : //# Copyright (C) 1996,1997,1998,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/PBMath1DGauss.h>
      33             : #include <casacore/measures/Measures.h>
      34             : #include <casacore/casa/Utilities/Assert.h>
      35             : 
      36             : 
      37             : 
      38             : 
      39             : using namespace casacore;
      40             : namespace casa { //# NAMESPACE CASA - BEGIN
      41             : 
      42           0 : PBMath1DGauss::PBMath1DGauss(Quantity halfWidth, Quantity maxRad, Quantity refFreq, 
      43             :                              Bool isThisVP,
      44             :                              BeamSquint squint,
      45           0 :                              Bool useSymmetricBeam) :
      46             :   PBMath1D(maxRad, refFreq, isThisVP, squint, useSymmetricBeam),
      47           0 :   halfWidth_p(halfWidth)
      48             : {
      49             : 
      50             :   // convert instantiation parameters to GHz*arcmin reference
      51           0 :   halfWidth_p = halfWidth_p * fScale_p;
      52             : 
      53             :   // fill the vp_p arrays
      54           0 :   fillPBArray();    
      55             : 
      56           0 :   if (useSymmetricBeam) {
      57           0 :     symmetrizeSquintedBeam();
      58             :   }
      59           0 : };
      60             : 
      61             : 
      62           0 : PBMath1DGauss::~PBMath1DGauss()
      63             : {
      64           0 : };
      65             : 
      66             : 
      67           0 : PBMath1DGauss& PBMath1DGauss::operator=(const PBMath1DGauss& other)
      68             : {
      69           0 :   if (this == &other)
      70           0 :     return *this;
      71             : 
      72           0 :   PBMath1D::operator=(other);
      73           0 :   halfWidth_p = other.halfWidth_p;
      74           0 :   return *this;
      75             : };
      76             : 
      77             : 
      78             : 
      79           0 : void PBMath1DGauss::fillPBArray()
      80             : {
      81             : 
      82           0 :   LogIO os(LogOrigin("PBMath1DGauss", "fillPBArray"));
      83           0 :   Int nSamples=10000;
      84           0 :   vp_p.resize(nSamples); 
      85             : 
      86           0 :   inverseIncrementRadius_p=Double(nSamples-1)/maximumRadius_p.getValue("'");
      87             :   
      88           0 :   Double fact = sqrt(1.0/log(2.0)) * halfWidth_p.getValue("'");
      89             :   // square (Math.h) mysteriously comes up as an undefined reference 
      90           0 :   Double fact2 = fact*fact;
      91           0 :   Double iir2 = inverseIncrementRadius_p * inverseIncrementRadius_p;
      92             :   
      93           0 :   for(Int i=0;i<nSamples;i++) {
      94           0 :     if (isThisVP_p) {
      95           0 :       vp_p(i) = exp(-(  ((Double)(i*i)) / iir2  / fact2) );
      96             :     } else {
      97           0 :       vp_p(i) = sqrt( exp(-(  ((Double)(i*i)) / iir2  / fact2) ) );
      98             :     }
      99             :   }
     100             : 
     101           0 : };
     102             : 
     103             : void
     104           0 : PBMath1DGauss::summary(Int nValues)
     105             : {
     106           0 :   PBMath1D::summary(nValues);
     107           0 :    LogIO os(LogOrigin("PBMath1DGauss", "summary"));
     108           0 :    os << "Gaussian HWHM: " << halfWidth_p.getValue("'") << " arcmin" <<  LogIO::POST;
     109           0 : };
     110             : 
     111             : 
     112             : } //# NAMESPACE CASA - END
     113             : 

Generated by: LCOV version 1.16