LCOV - code coverage report
Current view: top level - synthesis/MeasurementEquations - IPLatConvEquation.cc (source / functions) Hit Total Coverage
Test: casa_coverage.info Lines: 23 25 92.0 %
Date: 2023-10-25 08:47:59 Functions: 5 5 100.0 %

          Line data    Source code
       1             : //# IPLatConvEquation.cc:  this defines IPLatConvEquation
       2             : //# Copyright (C) 1996,1997,1998,1999,2001
       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 addressed 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             : //# $Id$
      27             : 
      28             : #include <synthesis/MeasurementEquations/IPLatConvEquation.h>
      29             : #include <synthesis/MeasurementEquations/LinearModel.h>
      30             : #include <synthesis/MeasurementEquations/LatticeModel.h>
      31             : #include <casacore/lattices/LEL/LatticeExpr.h>
      32             : #include <casacore/lattices/LEL/LatticeExprNode.h>
      33             : #include <casacore/lattices/Lattices/SubLattice.h>
      34             : #include <casacore/lattices/LRegions/LCBox.h>
      35             : #include <casacore/casa/Utilities/Assert.h>
      36             : #include <casacore/casa/Arrays/Vector.h>
      37             : #include <casacore/casa/Arrays/Array.h>
      38             : #include <casacore/casa/Arrays/ArrayMath.h>
      39             : #include <casacore/casa/Arrays/IPosition.h>
      40             : #include <casacore/casa/Exceptions/Error.h>
      41             : 
      42             : using namespace casacore;
      43             : namespace casa { //# NAMESPACE CASA - BEGIN
      44             : 
      45           2 : IPLatConvEquation::IPLatConvEquation(Lattice<Float> & psf, 
      46           2 :                                      Lattice<Float> & dirtyImage)
      47           2 :   : LatConvEquation(psf, dirtyImage)
      48             : {
      49           2 :   itsQ = sum(psf).getFloat();
      50           2 : }
      51             : 
      52           4 : IPLatConvEquation::~IPLatConvEquation() 
      53             : {
      54           4 : }
      55             : 
      56          16 : Bool IPLatConvEquation::residual(Lattice<Float> & result, 
      57             :                                const LinearModel< Lattice<Float> > & model) {
      58             : 
      59          16 :   if (LatConvEquation::residual(result, model)) {
      60             :     // Image Plane requires a second convolution
      61          32 :     TempLattice<Float> intermediate(result.shape());
      62          16 :     intermediate.copyData(result);
      63          16 :     LatticeModel intermediateModel (intermediate);
      64          16 :     if (LatConvEquation::evaluate(result, intermediateModel)) {
      65          16 :       result.copyData( LatticeExpr<Float>(result/itsQ) );
      66          16 :       return true;
      67             :     }
      68             :   }
      69           0 :   return false;
      70             : }
      71             : 
      72             : 
      73          16 : Bool IPLatConvEquation::residual(Lattice<Float> & result, 
      74             :                                Float & chisq,
      75             :                                const LinearModel<Lattice<Float> > & model) {
      76          16 :   if (LatConvEquation::residual(result, chisq, model)) {
      77             :     // Image Plane requires a second convolution
      78          32 :     TempLattice<Float> intermediate(result.shape());
      79          16 :     intermediate.copyData(result);
      80          16 :     LatticeModel intermediateModel (intermediate);
      81          16 :     if (LatConvEquation::evaluate(result, intermediateModel)) {
      82          16 :      result.copyData( LatticeExpr<Float>(result/itsQ) );
      83          16 :       return true;
      84             :     }
      85             :   }
      86           0 :   return false;
      87             : }
      88             : 
      89             : // Local Variables: 
      90             : // compile-command: "gmake OPTLIB=1 IPLatConvEquation"
      91             : // End: 
      92             : 
      93             : } //# NAMESPACE CASA - END
      94             : 

Generated by: LCOV version 1.16