LCOV - code coverage report
Current view: top level - imageanalysis/ImageAnalysis - LinearPolarizationAngleCalculator.cc (source / functions) Hit Total Coverage
Test: ctest_coverage.info Lines: 0 24 0.0 %
Date: 2023-11-02 14:27:30 Functions: 0 5 0.0 %

          Line data    Source code
       1             : //# Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003
       2             : //# Associated Universities, Inc. Washington DC, USA.
       3             : //#
       4             : //# This library is free software; you can redistribute it and/or modify it
       5             : //# under the terms of the GNU Library General Public License as published by
       6             : //# the Free Software Foundation; either version 2 of the License, or (at your
       7             : //# option) any later version.
       8             : //#
       9             : //# This library is distributed in the hope that it will be useful, but WITHOUT
      10             : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      11             : //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
      12             : //# License for more details.
      13             : //#
      14             : //# You should have received a copy of the GNU Library General Public License
      15             : //# along with this library; if not, write to the Free Software Foundation,
      16             : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
      17             : //#
      18             : //# Correspondence concerning AIPS++ should be addressed as follows:
      19             : //#        Internet email: aips2-request@nrao.edu.
      20             : //#        Postal address: AIPS++ Project Office
      21             : //#                        National Radio Astronomy Observatory
      22             : //#                        520 Edgemont Road
      23             : //#                        Charlottesville, VA 22903-2475 USA
      24             : //#
      25             : 
      26             : #include <imageanalysis/ImageAnalysis/LinearPolarizationAngleCalculator.h>
      27             : 
      28             : using namespace casacore;
      29             : namespace casa {
      30             : 
      31             : const String LinearPolarizationAngleCalculator::CLASS_NAME = "LinearPolarizationAngleCalculator";
      32             : 
      33           0 : LinearPolarizationAngleCalculator::LinearPolarizationAngleCalculator(
      34             :     const SPCIIF image, const String& outname, Bool overwrite
      35           0 : ) : ImagePolTask(image, outname, overwrite) {}
      36             : 
      37           0 : LinearPolarizationAngleCalculator::~LinearPolarizationAngleCalculator() {}
      38             : 
      39           0 : SPIIF LinearPolarizationAngleCalculator::compute(Bool radians) {
      40           0 :     *_getLog() << LogOrigin(CLASS_NAME, __func__, WHERE);
      41           0 :     auto q = _getStokesImage(Q);
      42           0 :     auto u = _getStokesImage(U);
      43           0 :     ThrowIf (
      44             :         ! q || ! u,
      45             :         "This image does not have Stokes Q and/or U so cannot "
      46             :         "compute linear polarization angle"
      47             :     );
      48           0 :     _checkQUBeams(False);
      49             :     // Make expression. LEL function "pa" returns degrees
      50           0 :     Float fac = radians ? C::pi / 180.0 : 1.0;
      51           0 :     LatticeExprNode node(fac*pa(*u, *q));
      52           0 :     LatticeExpr<Float> le(node);
      53           0 :     ImageExpr<Float> ie(le, String("LinearlyPolarizedPositionAngle"));
      54           0 :     ie.setUnits(Unit(radians ? "rad" : "deg"));
      55           0 :     ImageInfo ii = _getImage()->imageInfo();
      56           0 :     if (ii.hasMultipleBeams()) {
      57           0 :         *this->_getLog() << LogIO::WARN << "The input image has "
      58             :             << "multiple beams. Because these beams can vary with "
      59             :             << "stokes/polarization, they will not be copied to the "
      60           0 :             << "output image" << LogIO::POST;
      61           0 :         ii.removeRestoringBeam();
      62             :     }
      63           0 :     ie.setImageInfo(ii);
      64           0 :     _fiddleStokesCoordinate(ie, Stokes::Pangle);
      65           0 :     return _prepareOutputImage(ie);
      66             : }
      67             : 
      68           0 : String LinearPolarizationAngleCalculator::getClass() const {
      69           0 :     return CLASS_NAME;
      70             : }
      71             : 
      72             : }

Generated by: LCOV version 1.16