LCOV - code coverage report
Current view: top level - synthesis/TransformMachines2 - ATerm.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 40 44 90.9 %
Date: 2024-11-06 17:42:47 Functions: 2 2 100.0 %

          Line data    Source code
       1             : // -*- C++ -*-
       2             : //# EVLAAperture.cc: Implementation of the EVLAAperture class
       3             : //# Copyright (C) 1997,1998,1999,2000,2001,2002,2003
       4             : //# Associated Universities, Inc. Washington DC, USA.
       5             : //#
       6             : //# This library is free software; you can redistribute it and/or modify it
       7             : //# under the terms of the GNU Library General Public License as published by
       8             : //# the Free Software Foundation; either version 2 of the License, or (at your
       9             : //# option) any later version.
      10             : //#
      11             : //# This library is distributed in the hope that it will be useful, but WITHOUT
      12             : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      13             : //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
      14             : //# License for more details.
      15             : //#
      16             : //# You should have received a copy of the GNU Library General Public License
      17             : //# along with this library; if not, write to the Free Software Foundation,
      18             : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
      19             : //#
      20             : //# Correspondence concerning AIPS++ should be addressed as follows:
      21             : //#        Internet email: casa-feedback@nrao.edu.
      22             : //#        Postal address: AIPS++ Project Office
      23             : //#                        National Radio Astronomy Observatory
      24             : //#                        520 Edgemont Road
      25             : //#                        Charlottesville, VA 22903-2475 USA
      26             : //#
      27             : //# $Id$
      28             : //
      29             : #include <synthesis/TransformMachines2/ATerm.h>
      30             : #include <synthesis/TransformMachines/SynthesisError.h>
      31             : #include <casacore/coordinates/Coordinates/DirectionCoordinate.h>
      32             : #include <casacore/coordinates/Coordinates/SpectralCoordinate.h>
      33             : #include <casacore/coordinates/Coordinates/StokesCoordinate.h>
      34             : //
      35             : //---------------------------------------------------------------------
      36             : //
      37             : using namespace casacore;
      38             : namespace casa{
      39             :   using namespace refim;
      40         135 :   ATerm::ATerm(): CFTerms()
      41             :   {
      42             :     Int userValue;
      43             : 
      44         135 :     cachedOverSampling_p=OVERSAMPLING;
      45         135 :     userValue = SynthesisUtils::getenv("ATerm.OVERSAMPLING",OVERSAMPLING);
      46         135 :     if (userValue != cachedOverSampling_p)
      47             :       {
      48          49 :         cachedOverSampling_p = userValue;
      49          49 :                 cerr << "Oversampling set to " << cachedOverSampling_p << endl;
      50             :       }
      51             : 
      52             : 
      53         135 :     cachedConvSize_p=CONVSIZE;
      54         135 :     userValue = SynthesisUtils::getenv("ATerm.CONVSIZE",CONVSIZE);
      55         135 :     if (userValue != cachedConvSize_p)
      56             :       {
      57          49 :         cachedConvSize_p = userValue;
      58             :         //cerr << "ConvFuncSize set to " << cachedConvSize_p << endl;
      59             :       }
      60         135 :   };
      61             : 
      62           1 :   Int ATerm::makePBPolnCoords(//const VisBuffer&vb,
      63             :                               const Vector<Int>& vbCorrType,
      64             :                               const Int& convSize,
      65             :                               const Int& convSampling,
      66             :                               const CoordinateSystem& skyCoord,
      67             :                               const Int& skyNx, const Int& /*skyNy*/,
      68             :                               CoordinateSystem& feedCoord)
      69             :   //                                 Vector<Int>& cfStokes)
      70             :   {
      71           1 :     feedCoord = skyCoord;
      72             :     //
      73             :     // Make a two dimensional image to calculate auto-correlation of
      74             :     // the ideal illumination pattern. We want this on a fine grid in
      75             :     // the UV plane
      76             :     //
      77           1 :     Int directionIndex=skyCoord.findCoordinate(Coordinate::DIRECTION);
      78           1 :     AlwaysAssert(directionIndex>=0, AipsError);
      79           1 :     DirectionCoordinate dc=skyCoord.directionCoordinate(directionIndex);
      80           1 :     Vector<Double> sampling;
      81           1 :     sampling = dc.increment();
      82           1 :     sampling*=Double(convSampling);
      83           1 :     sampling*=Double(skyNx)/Double(convSize);
      84           1 :     dc.setIncrement(sampling);
      85             :     
      86             :     
      87           1 :     Vector<Double> unitVec(2);
      88           1 :     unitVec=convSize/2;
      89           1 :     dc.setReferencePixel(unitVec);
      90             :     
      91             :     // Set the reference value to that of the image
      92           1 :     feedCoord.replaceCoordinate(dc, directionIndex);
      93             : 
      94             :     //
      95             :     // Make an image with circular polarization axis.
      96             :     //
      97           1 :     Int NPol=0,M,N=0;
      98           1 :     M=polMap_p_base.nelements();
      99           3 :     for(Int i=0;i<M;i++) if (polMap_p_base(i) > -1) NPol++;
     100           1 :     Vector<Int> poln(NPol);
     101             :     
     102             :     Int index;
     103           1 :     Vector<Int> inStokes;
     104           1 :     index = feedCoord.findCoordinate(Coordinate::STOKES);
     105           1 :     inStokes = feedCoord.stokesCoordinate(index).stokes();
     106           1 :     N = 0;
     107             :     try
     108             :       {
     109             :         //      cerr << "### " << polMap_p_base << " " << vb.corrType() << endl;
     110           3 :         for(Int i=0;i<M;i++) if (polMap_p_base(i) > -1) {poln(N) = vbCorrType(i);N++;}
     111           1 :         StokesCoordinate polnCoord(poln);
     112           1 :         Int StokesIndex = feedCoord.findCoordinate(Coordinate::STOKES);
     113           1 :         feedCoord.replaceCoordinate(polnCoord,StokesIndex);
     114             :         //      cfStokes = poln;
     115           1 :       }
     116           0 :     catch(AipsError& x)
     117             :       {
     118           0 :         throw(SynthesisFTMachineError("Likely cause: Discrepancy between the poln. "
     119           0 :                                       "axis of the data and the image specifications."));
     120           0 :       }
     121             :     
     122           1 :     return NPol;
     123           1 :   }
     124             : };

Generated by: LCOV version 1.16