LCOV - code coverage report
Current view: top level - synthesis/TransformMachines - PBMathInterface.cc (source / functions) Hit Total Coverage
Test: ctest_coverage.info Lines: 40 98 40.8 %
Date: 2023-11-06 10:06:49 Functions: 10 14 71.4 %

          Line data    Source code
       1             : //# PBMathInterface.cc: Implementation for PBMathInterface
       2             : //# Copyright (C) 1996,1997,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 adressed as follows:
      20             : //#        Internet email: aips2-request@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 <synthesis/TransformMachines/PBMathInterface.h>
      32             : 
      33             : #include <casacore/measures/Measures/Stokes.h>
      34             : #include <casacore/casa/BasicSL/Constants.h>
      35             : 
      36             : #include <components/ComponentModels/Flux.h>
      37             : #include <components/ComponentModels/ComponentShape.h>
      38             : #include <components/ComponentModels/SkyComponent.h>
      39             : 
      40             : #include <casacore/images/Images/ImageInterface.h>
      41             : #include <casacore/lattices/Lattices/LatticeStepper.h>
      42             : #include <casacore/lattices/Lattices/LatticeIterator.h>
      43             : 
      44             : #include <casacore/coordinates/Coordinates/CoordinateSystem.h>
      45             : #include <casacore/coordinates/Coordinates/DirectionCoordinate.h>
      46             : #include <casacore/coordinates/Coordinates/SpectralCoordinate.h>
      47             : #include <casacore/coordinates/Coordinates/StokesCoordinate.h>
      48             : #include <casacore/coordinates/Coordinates/Projection.h>
      49             : 
      50             : #include <casacore/casa/Utilities/Assert.h>
      51             : #include <casacore/casa/BasicSL/String.h>
      52             : 
      53             : using namespace casacore;
      54             : namespace casa { //# NAMESPACE CASA - BEGIN
      55             : 
      56         271 : PBMathInterface::PBMathInterface() : bandOrFeedName_p("")
      57             : {
      58         271 : };
      59             : 
      60        2543 : PBMathInterface::~PBMathInterface()
      61             : {
      62        2543 : };
      63             : 
      64             : 
      65             : 
      66        2290 : PBMathInterface::PBMathInterface(Bool isThisVP,
      67             :                                  BeamSquint squint,
      68        2290 :                                  Bool useSymmetricBeam) :
      69             : isThisVP_p(isThisVP),
      70             : squint_p(squint),
      71        2290 : useSymmetricBeam_p(useSymmetricBeam), bandOrFeedName_p("")
      72             : {
      73        2290 : };
      74             : 
      75             : 
      76             : void
      77          34 : PBMathInterface::namePBClass(String & str)
      78             : {
      79          34 :   PBMathInterface::PBClass iPB = whichPBClass();
      80          34 :   switch (iPB) {
      81           0 :   case PBMathInterface::NONE:
      82           0 :     str = "NONE";
      83           0 :     break;
      84          34 :   case PBMathInterface::AIRY:
      85          34 :     str = "AIRY";
      86          34 :     break;
      87           0 :   case PBMathInterface::GAUSS:
      88           0 :     str = "GAUSSIAN";
      89           0 :     break;
      90           0 :   case PBMathInterface::POLY:
      91           0 :     str = "POLYNOMIAL";
      92           0 :     break;
      93           0 :   case PBMathInterface::IPOLY:
      94           0 :     str = "INVERSE POLYNOMIAL";
      95           0 :     break;
      96           0 :   case PBMathInterface::COSPOLY:
      97           0 :     str = "COSINE POLYNOMIAL";
      98           0 :     break;
      99           0 :   case PBMathInterface::NUMERIC:
     100           0 :     str = "NUMERIC";
     101           0 :     break;
     102           0 :   case PBMathInterface::IMAGE:
     103           0 :     str = "IMAGE";
     104           0 :     break;
     105           0 :   case PBMathInterface::ZERNIKE:
     106           0 :     str = "ZERNIKE";
     107           0 :     break;
     108           0 :   default:
     109           0 :     str = "UNKNOWN";
     110           0 :     break;
     111             :   }
     112          34 : };
     113             : 
     114             : void 
     115          17 : PBMathInterface::namePBClass(const PBMathInterface::PBClass iPB,  String & str)
     116             : {
     117          17 :   switch (iPB) {
     118           0 :   case PBMathInterface::NONE:
     119           0 :     str = "NONE";
     120           0 :     break;
     121           0 :   case PBMathInterface::AIRY:
     122           0 :     str = "AIRY";
     123           0 :     break;
     124           0 :   case PBMathInterface::GAUSS:
     125           0 :     str = "GAUSSIAN";
     126           0 :     break;
     127           4 :   case PBMathInterface::POLY:
     128           4 :     str = "POLYNOMIAL";
     129           4 :     break;
     130          13 :   case PBMathInterface::IPOLY:
     131          13 :     str = "INVERSE POLYNOMIAL";
     132          13 :     break;
     133           0 :   case PBMathInterface::COSPOLY:
     134           0 :     str = "COSINE POLYNOMIAL";
     135           0 :     break;
     136           0 :   case PBMathInterface::NUMERIC:
     137           0 :     str = "NUMERIC";
     138           0 :     break;
     139           0 :   case PBMathInterface::IMAGE:
     140           0 :     str = "IMAGE";
     141           0 :     break;
     142           0 :   case PBMathInterface::ZERNIKE:
     143           0 :     str = "ZERNIKE";
     144           0 :     break;
     145           0 :   default:
     146           0 :     str = "UNKNOWN";
     147           0 :     break;
     148             :   }
     149          17 : };
     150             : 
     151             : 
     152             : //forward each function call to the virtual private apply method
     153             : 
     154             : ImageInterface<Complex>&  
     155        1270 : PBMathInterface::applyVP(const ImageInterface<Complex>& in,
     156             :                          ImageInterface<Complex>& out,
     157             :                          const MDirection& sp,
     158             :                          const Quantity parAngle,
     159             :                          const BeamSquint::SquintType doSquint,
     160             :                          Bool inverse,
     161             :                          Bool conjugate,
     162             :                          Float cutoff,
     163             :                          Bool forward)
     164             : {
     165             :   return apply(in, out, sp, parAngle, doSquint, inverse, conjugate, 1, cutoff,
     166        1270 :                forward); 
     167             : };
     168             : 
     169             : 
     170             : ImageInterface<Complex>&  
     171        1979 : PBMathInterface::applyPB(const ImageInterface<Complex>& in,
     172             :                          ImageInterface<Complex>& out,
     173             :                          const MDirection& sp,
     174             :                          const Quantity parAngle,
     175             :                          const BeamSquint::SquintType doSquint,
     176             :                          Bool inverse,
     177             :                          Float cutoff,
     178             :                          Bool forward)
     179             : {
     180        1979 :   return apply(in, out, sp, parAngle, doSquint, inverse, false, 2, cutoff, forward);
     181             : };
     182             : 
     183             : ImageInterface<Float>&  
     184           0 : PBMathInterface::applyPB(const ImageInterface<Float>& in,
     185             :                           ImageInterface<Float>& out,
     186             :                           const MDirection& sp,
     187             :                           const Quantity parAngle,
     188             :                           const BeamSquint::SquintType doSquint,
     189             :                           Float cutoff)
     190             : {
     191           0 :   return apply(in, out, sp, parAngle, doSquint, cutoff, 2);
     192             : };
     193             : 
     194             : ImageInterface<Float>&  
     195          40 : PBMathInterface::applyPB2(const ImageInterface<Float>& in,
     196             :                           ImageInterface<Float>& out,
     197             :                           const MDirection& sp,
     198             :                           const Quantity parAngle,
     199             :                           const BeamSquint::SquintType doSquint,
     200             :                           Float cutoff)
     201             : {
     202          40 :   return apply(in, out, sp, parAngle, doSquint, cutoff);
     203             : };
     204             : 
     205             : SkyComponent& 
     206           0 : PBMathInterface::applyVP(SkyComponent& in,
     207             :                          SkyComponent& out,
     208             :                          const MDirection& sp,
     209             :                          const Quantity frequency,
     210             :                          const Quantity parAngle,
     211             :                          const BeamSquint::SquintType doSquint,
     212             :                          Bool inverse,
     213             :                          Bool conjugate,
     214             :                          Float cutoff,
     215             :                          Bool forward)
     216             : {
     217             :   return apply(in, out, sp, frequency, parAngle, doSquint, inverse, conjugate, 1, cutoff,
     218           0 :                forward);
     219             : };
     220             : 
     221             : SkyComponent& 
     222        2491 : PBMathInterface::applyPB(SkyComponent& in,
     223             :                          SkyComponent& out,
     224             :                          const MDirection& sp,
     225             :                          const Quantity frequency,
     226             :                          const Quantity parAngle,
     227             :                          const BeamSquint::SquintType doSquint,
     228             :                          Bool inverse,
     229             :                          Float cutoff,
     230             :                          Bool forward)
     231             : {
     232             :   return apply(in, out, sp, frequency, parAngle, doSquint, inverse, false, 2, cutoff,
     233        2491 :                forward);
     234             : };
     235             : 
     236             : SkyComponent& 
     237           0 : PBMathInterface::applyPB2(SkyComponent& in,
     238             :                           SkyComponent& out,
     239             :                           const MDirection& sp,
     240             :                           const Quantity frequency,
     241             :                           const Quantity parAngle,
     242             :                           const BeamSquint::SquintType doSquint)
     243             : {
     244           0 :   return apply(in, out, sp, frequency, parAngle, doSquint, false, false, 4, 0.0, true);
     245             : };
     246             : 
     247             : 
     248             : void
     249          17 : PBMathInterface::summary(Int /*nValues*/)
     250             : {
     251          51 :   LogIO os(LogOrigin("PBMathInterface", "summary"));
     252          17 :   if (isThisVP_p) {
     253          17 :     os << "These parameters are for Voltage Pattern" <<  LogIO::POST;
     254             :   } else {
     255           0 :     os << "These parameters are for primary Beam" <<  LogIO::POST;
     256             :   }
     257          17 :   if (squint_p.isNonNull()) {
     258           3 :     squint_p.show();
     259             :   } else {
     260          14 :     os << "No Beam Squint" <<  LogIO::POST;
     261             :   }
     262          17 : };
     263             : 
     264             : } //# NAMESPACE CASA - END
     265             : 

Generated by: LCOV version 1.16