LCOV - code coverage report
Current view: top level - imageanalysis/ImageAnalysis - LinearPolarizationCalculator.cc (source / functions) Hit Total Coverage
Test: ctest_coverage.info Lines: 27 30 90.0 %
Date: 2023-11-06 10:06:49 Functions: 6 8 75.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/LinearPolarizationCalculator.h>
      27             : 
      28             : using namespace casacore;
      29             : namespace casa {
      30             : 
      31             : const String LinearPolarizationCalculator::CLASS_NAME = "LinearPolarizationCalculator";
      32             : 
      33           3 : LinearPolarizationCalculator::LinearPolarizationCalculator(
      34             :     const SPCIIF image, const String& outname, Bool overwrite
      35           3 : ) : ImagePolTask(image, outname, overwrite) {}
      36             : 
      37           3 : LinearPolarizationCalculator::~LinearPolarizationCalculator() {}
      38             : 
      39           3 : SPIIF LinearPolarizationCalculator::compute() {
      40           3 :     *_getLog() << LogOrigin(CLASS_NAME, __func__, WHERE);
      41           6 :     auto q = _getStokesImage(Q);
      42           6 :     auto u = _getStokesImage(U);
      43           3 :     ThrowIf(
      44             :         ! q || ! u,
      45             :         "This image does not have Stokes Q and/or U so cannot compute linear polarization"
      46             :     );
      47           3 :     _checkQUBeams(false);
      48           6 :     auto node = _makePolIntNode(_debias, _clip, _sigma, True, False);
      49             :     // Make expression
      50           6 :     LatticeExpr<Float> le(node);
      51           9 :     ImageExpr<Float> ie(le, String("LinearlyPolarizedIntensity"));
      52           3 :     ie.setUnits(_getImage()->units());
      53           3 :     _setInfo(ie, Q);
      54             :     // Fiddle Stokes coordinate in ImageExpr
      55           3 :     _fiddleStokesCoordinate(ie, Stokes::Plinear);
      56           3 :     auto out = _prepareOutputImage(ie);
      57           3 :     if (_debias) {
      58           0 :         _maskAndZeroNaNs(out);
      59             :     }
      60           6 :     return out;
      61             : }
      62             : 
      63           0 : String LinearPolarizationCalculator::getClass() const {
      64           0 :     return CLASS_NAME;
      65             : }
      66             : 
      67             : 
      68           3 : void LinearPolarizationCalculator::setClip(Float clip) {
      69           3 :     _clip = clip;
      70           3 : }
      71             : 
      72           3 : void LinearPolarizationCalculator::setDebias(Bool debias) {
      73           3 :     _debias = debias;
      74           3 : }
      75             : 
      76           3 : void LinearPolarizationCalculator::setSigma(Float sigma) {
      77           3 :     _sigma = sigma;
      78           3 : }
      79             : 
      80             : }

Generated by: LCOV version 1.16