LCOV - code coverage report
Current view: top level - synthesis/TransformMachines2 - AWProjectWBFTNew.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 23 0.0 %
Date: 2024-10-09 13:55:54 Functions: 0 2 0.0 %

          Line data    Source code
       1             : // -*- C++ -*-
       2             : //# AWProjectWBFT.cc: Implementation of AWProjectWBFT 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/AWProjectWBFTNew.h>
      30             : 
      31             : #include <synthesis/TransformMachines2/AWVisResampler.h>
      32             : #include <synthesis/TransformMachines/StokesImageUtil.h>
      33             : #include <casacore/coordinates/Coordinates/CoordinateSystem.h>
      34             : #include <casacore/scimath/Mathematics/FFTServer.h>
      35             : #include <casacore/scimath/Mathematics/Convolver.h>
      36             : #include <casacore/lattices/LatticeMath/LatticeFFT.h>
      37             : #include <casacore/images/Images/ImageInterface.h>
      38             : #include <casacore/images/Images/PagedImage.h>
      39             : #include <msvis/MSVis/VisBuffer2.h>
      40             : #include <casacore/casa/Arrays/Vector.h>
      41             : #include <casacore/casa/Arrays/Slice.h>
      42             : #include <casacore/casa/Arrays/ArrayMath.h>
      43             : #include <casacore/casa/Arrays/Array.h>
      44             : #include <casacore/casa/OS/HostInfo.h>
      45             : #include <sstream>
      46             : #include <casacore/casa/Utilities/CompositeNumber.h>
      47             : 
      48             : using namespace casacore;
      49             : namespace casa { //# NAMESPACE CASA - BEGIN
      50             :   namespace refim{
      51             :   //---------------------------------------------------------------
      52             :   // 
      53             : 
      54             : //-----------------------------------------------------------------------
      55           0 :   FTMachine* AWProjectWBFTNew::cloneFTM(){
      56           0 :     return new AWProjectWBFTNew(*this);
      57             :   }
      58             : 
      59             : 
      60           0 :   void AWProjectWBFTNew::ftWeightImage(Lattice<Complex>& wtImage, 
      61             :                                     const Matrix<Float>& sumWt,
      62             :                                     const Bool& doFFTNorm)
      63             :   {
      64           0 :     LogIO log_l(LogOrigin("AWProjectWBFTNew2", "ftWeightImage[R&D]"));
      65           0 :     if (wtImageFTDone_p) return;
      66             : 
      67           0 :     if ((sumWt.shape().nelements() < 2) || 
      68           0 :         (sumWt.shape()(0) != wtImage.shape()(2)) || 
      69           0 :         (sumWt.shape()(1) != wtImage.shape()(3)))
      70           0 :       log_l << "Sum of weights per poln and chan is required" << LogIO::EXCEPTION;
      71             :     //
      72             :     // Use only the amplitude of the gridded weights.  LatticeExpr
      73             :     // classes while useful, appear to be too strict about types (the
      74             :     // code below will not compile if the abs(wtImage) is not
      75             :     // converted back to a complex type).
      76             : 
      77           0 :     LatticeFFT::cfft2d(wtImage,false);
      78           0 :     wtImageFTDone_p=true;
      79             : 
      80           0 :     Int sizeX=wtImage.shape()(0), sizeY=wtImage.shape()(1);
      81             : 
      82           0 :     Array<Complex> wtBuf; wtImage.get(wtBuf,false);
      83           0 :     ArrayLattice<Complex> wtLat(wtBuf,true);
      84             :     //
      85             :     // Copy one 2D plane at a time, normalizing by the sum of weights
      86             :     // and possibly 2D FFT.
      87             :     //
      88             :     // Set up Lattice iterators on wtImage and sensitivityImage
      89             :     //
      90           0 :     IPosition axisPath(4, 0, 1, 2, 3);
      91           0 :     IPosition cursorShape(4, sizeX, sizeY, 1, 1);
      92             : 
      93           0 :     LatticeStepper wtImStepper(wtImage.shape(), cursorShape, axisPath);
      94           0 :     LatticeIterator<Complex> wtImIter(wtImage, wtImStepper);
      95             :     //
      96             :     // Iterate over channel and polarization axis
      97             :     //
      98           0 :     if (!doFFTNorm) sizeX=sizeY=1;
      99             :     //
     100             :     // Normalize each frequency and polarization plane of the complex
     101             :     // sensitivity pattern
     102             :     //
     103             :     // getSumOfCFWeights() returns the sum-of-weight appropriate for
     104             :     // computing sensitivity patterns (which could be different from
     105             :     // the data-sum-of-weights.
     106             :     //
     107             : 
     108           0 :     for(wtImIter.reset(); !wtImIter.atEnd(); wtImIter++)
     109             :       {
     110           0 :         wtImIter.rwCursor() = (wtImIter.rwCursor()
     111           0 :                                *Float(sizeX)*Float(sizeY));
     112             :       }
     113           0 :   }
     114             : 
     115             :  
     116             : } //# NAMESPACE CASA - END
     117             : }

Generated by: LCOV version 1.16