LCOV - code coverage report
Current view: top level - msvis/MSVis/statistics - Vi2StatsSigmasIterator.cc (source / functions) Hit Total Coverage
Test: casa_coverage.info Lines: 2 50 4.0 %
Date: 2023-10-25 08:47:59 Functions: 1 16 6.2 %

          Line data    Source code
       1             : //# Copyright (C) 1996,1997,1998,1999,2000,2002,2003,2015
       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             : // Data provider weights iterators, based on sigma column
      27             : //
      28             : #include <msvis/MSVis/statistics/Vi2StatsSigmasIterator.h>
      29             : 
      30             : using namespace casacore;
      31             : namespace casa {
      32             : 
      33           0 : Vi2StatsSigmasCubeIterator::Vi2StatsSigmasCubeIterator(vi::VisBuffer2 *vb2)
      34             :         : Vi2StatsSigmasIterator(vb2)
      35             :         , correlation(0)
      36           0 :         , nCorrelations(vb2->nCorrelations())
      37             :         , channel(0)
      38           0 :         , nChannels(vb2->nChannels())
      39             :         , row(0)
      40           0 :         , nRows(vb2->nRows()) {}
      41             : 
      42      705720 : Vi2StatsSigmasCubeIterator::Vi2StatsSigmasCubeIterator()
      43      705720 :         : Vi2StatsSigmasIterator() {}
      44             : 
      45             : Vi2StatsSigmasCubeIterator&
      46           0 : Vi2StatsSigmasCubeIterator::operator++()
      47             : {
      48           0 :         if (++correlation == nCorrelations) {
      49           0 :                 correlation = 0;
      50           0 :                 if (++channel == nChannels) {
      51           0 :                         channel = 0;
      52           0 :                         ++row;
      53             :                 }
      54             :         }
      55           0 :         return *this;
      56             : }
      57             : 
      58             : Vi2StatsSigmasCubeIterator
      59           0 : Vi2StatsSigmasCubeIterator::operator++(int)
      60             : {
      61           0 :         Vi2StatsSigmasCubeIterator tmp(*this);
      62           0 :         operator++();
      63           0 :         return tmp;
      64             : }
      65             : 
      66             : bool
      67           0 : Vi2StatsSigmasCubeIterator::operator==(const Vi2StatsSigmasCubeIterator& rhs)
      68             : {
      69           0 :         return (correlation == rhs.correlation
      70           0 :                 && channel == rhs.channel
      71           0 :                 && row == rhs.row);
      72             : }
      73             : 
      74             : bool
      75           0 : Vi2StatsSigmasCubeIterator::operator!=(const Vi2StatsSigmasCubeIterator& rhs)
      76             : {
      77           0 :         return (correlation != rhs.correlation
      78           0 :                 || channel != rhs.channel
      79           0 :                 || row != rhs.row);
      80             : }
      81             : 
      82             : Float
      83           0 : Vi2StatsSigmasCubeIterator::operator*()
      84             : {
      85           0 :         Float sigma = vb2->getSigmaScaled(correlation, channel, row);
      86           0 :         return ((sigma > 0.0f) ? (1.0f / (sigma * sigma)) : 0.0f);
      87             : }
      88             : 
      89             : bool
      90           0 : Vi2StatsSigmasCubeIterator::atEnd()
      91             : {
      92           0 :         return (correlation == 0 && channel == 0 && row == nRows);
      93             : }
      94             : 
      95             : 
      96             : 
      97           0 : Vi2StatsSigmasRowIterator::Vi2StatsSigmasRowIterator(vi::VisBuffer2 *vb2)
      98             :         : Vi2StatsSigmasIterator(vb2)
      99           0 :         , nRows(vb2->nRows()) {}
     100             : 
     101           0 : Vi2StatsSigmasRowIterator::Vi2StatsSigmasRowIterator()
     102           0 :         : Vi2StatsSigmasIterator() {}
     103             : 
     104             : Vi2StatsSigmasRowIterator&
     105           0 : Vi2StatsSigmasRowIterator::operator++()
     106             : {
     107           0 :         ++row;
     108           0 :         return *this;
     109             : }
     110             : 
     111             : Vi2StatsSigmasRowIterator
     112           0 : Vi2StatsSigmasRowIterator::operator++(int)
     113             : {
     114           0 :         Vi2StatsSigmasRowIterator tmp(*this);
     115           0 :         operator++();
     116           0 :         return tmp;
     117             : }
     118             : 
     119             : bool
     120           0 : Vi2StatsSigmasRowIterator::operator==(const Vi2StatsSigmasRowIterator& rhs)
     121             : {
     122           0 :         return row == rhs.row;
     123             : }
     124             : 
     125             : bool
     126           0 : Vi2StatsSigmasRowIterator::operator!=(const Vi2StatsSigmasRowIterator& rhs)
     127             : {
     128           0 :         return row != rhs.row;
     129             : }
     130             : 
     131             : Float
     132           0 : Vi2StatsSigmasRowIterator::operator*()
     133             : {
     134           0 :         Float sigma = vb2->getSigmaScaled(row);
     135           0 :         return ((sigma > 0.0f) ? (1.0f / (sigma * sigma)) : 0.0f);
     136             : }
     137             : 
     138             : bool
     139           0 : Vi2StatsSigmasRowIterator::atEnd()
     140             : {
     141           0 :         return row == nRows;
     142             : }
     143             : 
     144             : using namespace casacore;
     145             : } // namespace casa

Generated by: LCOV version 1.16