LCOV - code coverage report
Current view: top level - synthesis/TransformMachines - AzElAperture.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 40 0.0 %
Date: 2024-10-10 15:00:01 Functions: 0 2 0.0 %

          Line data    Source code
       1             : // -*- C++ -*-
       2             : //# AzElAperture.cc: Implementation of the AzElAperture 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/TransformMachines/AzElAperture.h>
      30             : #include <ostream>
      31             : using namespace casacore;
      32             : namespace casa{
      33             :   //
      34           0 :   void AzElAperture::rotate(const VisBuffer& vb, CFCell& cfc, const Double& rotAngleIncr) 
      35             :     {
      36           0 :       LogIO log_l(LogOrigin("AzElAperture", "rotate"));
      37           0 :       Double R2D = 57.2957795131;
      38             :       // If the A-Term is a No-Op, the resulting CF is rotationally
      39             :       // symmetric.
      40           0 :       if (isNoOp()) return;
      41             : 
      42           0 :       Double actualPA = getPA(vb), currentCFPA = cfc.pa_p.getValue("rad");
      43           0 :       cerr << "AzEL: ######### " << cfc.pa_p.getValue("deg") << " " << actualPA*R2D << " " << cfc.getStorage()->shape() << endl;
      44           0 :       Double dPA = currentCFPA-actualPA;
      45             :       //Double dPA = cachedCFCPA_p-actualPA;
      46           0 :       if (fabs(dPA) > fabs(rotAngleIncr))
      47             :         //      if (fabs(actualPA-currentCFPA) > 0.0)
      48             :         {
      49             :           //if (cachedCFCPA_p == 400.0) cachedCFCPA_p=currentCFPA;
      50             : 
      51           0 :           if (cachedCFC_p.nelements() == 0)
      52             :             {
      53           0 :               log_l << "Making a base copy of the current CFC@ PA=" << currentCFPA*R2D << LogIO::POST;
      54           0 :               cachedCFC_p.assign(*cfc.getStorage());
      55           0 :               cachedCFCPA_p = cfc.pa_p.getValue("rad");
      56             :             }
      57           0 :           dPA = cachedCFCPA_p-actualPA;
      58           0 :           Array<TT> inData;
      59             :           //inData.assign(*cfc.getStorage());
      60           0 :           inData.assign(cachedCFC_p);
      61             :           // log_l  << actualPA << " " << currentCFPA << LogIO::POST;
      62             :           // cerr << "dPA = " << actualPA << " " << currentCFPA << " " 
      63             :           //      << actualPA - currentCFPA << " " << &(*cfc.getStorage()) << endl;
      64           0 :           log_l << "Rotating the base CFC from PA=" << cachedCFCPA_p*R2D << " to " << actualPA*R2D << " " << dPA*R2D << " " << inData.shape() << " "
      65           0 :                 << "SPW: " << vb.spectralWindow() << " Field: " << vb.fieldId()
      66           0 :                 << LogIO::POST;
      67           0 :           SynthesisUtils::rotateComplexArray(log_l, inData, cfc.coordSys_p,
      68           0 :                                              *cfc.getStorage(),
      69             :                                              dPA);//,"LINEAR");
      70             :                                              // currentCFPA-actualPA);//,"LINEAR");
      71             :           // Update the PA value in the CF-Cache
      72           0 :           cfc.pa_p=Quantity(actualPA, "rad");
      73             : 
      74             :           // static Int ii=0;
      75             :           // {
      76             :           //   ostringstream name;
      77             :           //   name << "cfc." << ii << ".im";
      78             :           //   cfc.makePersistent(name.str().c_str());
      79             :           //   ii++;
      80             :           // }
      81           0 :         }
      82           0 :     };
      83             : 
      84           0 :   void AzElAperture::rotate2(const VisBuffer& vb, CFCell& baseCFC, CFCell& cfc, const Double& rotAngleIncr) 
      85             :     {
      86           0 :       LogIO log_l(LogOrigin("AzElAperture", "rotate"));
      87             : 
      88             :       // If the A-Term is a No-Op, the resulting CF is rotationally
      89             :       // symmetric.
      90           0 :       if (isNoOp()) return;
      91             : 
      92             :       (void)baseCFC;
      93             : 
      94           0 :       Double actualPA = getPA(vb), currentCFPA = cfc.pa_p.getValue("rad");
      95             :       //Double baseCFCPA=baseCFC.pa_p.getValue("rad");
      96             : 
      97           0 :       Double dPA = currentCFPA-actualPA;
      98             : 
      99           0 :       if (fabs(dPA) > fabs(rotAngleIncr))
     100             :         {
     101           0 :           Array<TT> inData;
     102             :           //inData.assign(*baseCFC.getStorage());
     103             :           //dPA = baseCFCPA-actualPA;
     104           0 :           dPA = currentCFPA-actualPA;
     105           0 :           inData.assign(*cfc.getStorage());
     106             :           try
     107             :             {
     108           0 :               SynthesisUtils::rotateComplexArray(log_l, inData, cfc.coordSys_p,
     109           0 :                                                  *cfc.getStorage(),
     110             :                                                  dPA);//,"LINEAR");
     111             :               // currentCFPA-actualPA);//,"LINEAR");
     112             :             }
     113           0 :           catch (AipsError &x)
     114             :             {
     115           0 :               log_l << x.getMesg() << LogIO::EXCEPTION;
     116           0 :             }
     117           0 :           cfc.pa_p=Quantity(actualPA, "rad");
     118           0 :         }
     119           0 :     };
     120             : };

Generated by: LCOV version 1.16