LCOV - code coverage report
Current view: top level - flagging/Flagging - RFAFlagCubeBase.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 60 0.0 %
Date: 2024-10-12 00:35:29 Functions: 0 19 0.0 %

          Line data    Source code
       1             : //# RFAFlagCubeBase.cc: this defines RFAFlagCubeBase
       2             : //# Copyright (C) 2000,2001,2002
       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: casa-feedback@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             : #include <flagging/Flagging/RFAFlagCubeBase.h>
      28             :    
      29             : using namespace casacore;
      30             : namespace casa { //# NAMESPACE CASA - BEGIN
      31             : 
      32             : uInt RFABase::indexing_base = 0;
      33             :  
      34             : // -----------------------------------------------------------------------
      35             : // RFABase constructor
      36             : // -----------------------------------------------------------------------
      37           0 : RFABase::RFABase ( RFChunkStats &ch,const RecordInterface &parm )
      38           0 :   : chunk(ch),params(parm),
      39           0 :     myname(parm.isDefined(RF_NAME)?parm.asString(RF_NAME):String("RFABase")),
      40           0 :     only_selector(false),
      41           0 :     os(LogOrigin("Flagger",myname))
      42             : {
      43           0 : }
      44             : 
      45           0 : void RFABase::init ()
      46             : {
      47           0 :     os << LogIO::DEBUGGING << myname << ": " << getDesc() << endl << LogIO::POST;
      48           0 : }
      49             :         
      50             : // -----------------------------------------------------------------------
      51             : // RFAFlagCubeBase constructor
      52             : // Construct from a Record of parameters
      53             : // -----------------------------------------------------------------------
      54           0 : RFAFlagCubeBase::RFAFlagCubeBase (  RFChunkStats &ch,const RecordInterface &parm ) :
      55             :   RFABase(ch,parm),
      56           0 :   flag(ch,isFieldSet(parm,RF_FIGNORE),isFieldSet(parm,RF_RESET),os)
      57             : {
      58           0 : }
      59             : 
      60             : // -----------------------------------------------------------------------
      61             : // Destructor
      62             : // -----------------------------------------------------------------------
      63           0 : RFAFlagCubeBase::~RFAFlagCubeBase () 
      64             : {
      65           0 : }
      66             : 
      67             : // -----------------------------------------------------------------------
      68             : // RFAFlagCubeBase::getDefaults
      69             : // Returns record of default parameters
      70             : // -----------------------------------------------------------------------
      71           0 : const RecordInterface & RFAFlagCubeBase::getDefaults ()
      72             : {
      73           0 :   static Record rec;
      74             : // create record description on first entry
      75           0 :   if( !rec.nfields() )
      76             :   {
      77           0 :     rec.define(RF_FIGNORE,false);
      78           0 :     rec.setComment(RF_FIGNORE,"Use T to ignore existing flags");
      79             :   }
      80           0 :   return rec;
      81             : }
      82             : 
      83             : // -----------------------------------------------------------------------
      84             : // RFAFlagCubeBase::getDesc
      85             : // Returns description of parameters
      86             : // -----------------------------------------------------------------------
      87           0 : String RFAFlagCubeBase::getDesc ()
      88             : {
      89             : //   if( fieldType(params,RF_POLICY,TpString) )
      90             : //   {
      91             : //     char s[128];
      92             : //     sprintf(s,"%s=%s",RF_POLICY,params.asString(RF_POLICY).chars());
      93             : //     return s;
      94             : //   }
      95           0 :   if( isFieldSet(params,RF_FIGNORE) )
      96           0 :     return RF_FIGNORE;
      97           0 :   return "";
      98             : }
      99             : 
     100             : // -----------------------------------------------------------------------
     101             : // RFAFlagCubeBase::getStats
     102             : // Returns flagging stats
     103             : // -----------------------------------------------------------------------
     104           0 : String RFAFlagCubeBase::getStats ()
     105             : {  
     106           0 :   return flag.getSummary();
     107             : }
     108             : 
     109             : // -----------------------------------------------------------------------
     110             : // RFAFlagCubeBase::estimateMemoryUse
     111             : // -----------------------------------------------------------------------
     112           0 : uInt RFAFlagCubeBase::estimateMemoryUse ()
     113             : {
     114           0 :   return 0;
     115             : // NB: RedFlagger check the flag cube memoery usage manually!
     116             : //  return flag.estimateMemoryUse();
     117             : }
     118             : 
     119             : // -----------------------------------------------------------------------
     120             : // RFAFlagCubeBase::newChunk
     121             : // Sets up for new chunk of data
     122             : // -----------------------------------------------------------------------
     123           0 : Bool RFAFlagCubeBase::newChunk (Int &)
     124             : {
     125           0 :   flag.init(corrmask, nAgent, only_selector, name());
     126           0 :   return active=true;
     127             : }
     128             : 
     129             : // -----------------------------------------------------------------------
     130             : // RFAFlagCubeBase::endChunk
     131             : // Resets at end of chunk
     132             : // -----------------------------------------------------------------------
     133           0 : void RFAFlagCubeBase::endChunk ()
     134             : {
     135           0 :   flag.printStats();
     136           0 :   flag.cleanup();
     137           0 : }
     138             : 
     139             : // -----------------------------------------------------------------------
     140             : // RFAFlagCubeBase::startData
     141             : // Prepares for an data pass over a VisIter chunk
     142             : // -----------------------------------------------------------------------
     143           0 : void RFAFlagCubeBase::startData (bool)
     144             : {
     145           0 :   flag.reset();
     146           0 : }
     147             : 
     148             : // -----------------------------------------------------------------------
     149             : // RFAFlagCubeBase::startDry
     150             : // Prepares for an dry pass 
     151             : // -----------------------------------------------------------------------
     152           0 :     void RFAFlagCubeBase::startDry (bool)
     153             : {
     154           0 :   flag.reset();
     155           0 : }
     156             : 
     157             : // -----------------------------------------------------------------------
     158             : // RFAFlagCubeBase::startFlag
     159             : // Prepares for a flag-copy pass
     160             : // -----------------------------------------------------------------------
     161           0 : void RFAFlagCubeBase::startFlag (bool)
     162             : {
     163           0 :   flag.reset();
     164           0 : }
     165             : 
     166             : // -----------------------------------------------------------------------
     167             : // RFAFlagCubeBase::iterTime
     168             : // Default version of iter time just keeps the diff and flag lattices
     169             : // in sync with the time slot.
     170             : // -----------------------------------------------------------------------
     171           0 : RFA::IterMode RFAFlagCubeBase::iterTime (uInt it)
     172             : {
     173           0 :   flag.advance(it,true);
     174           0 :   return RFA::CONT;
     175             : }
     176             : 
     177             : // -----------------------------------------------------------------------
     178             : // RFAFlagCubeBase::iterDry
     179             : // Dry run iterator: recomputes the AAD and does flagging
     180             : // -----------------------------------------------------------------------
     181           0 : RFA::IterMode RFAFlagCubeBase::iterDry ( uInt it )
     182             : {
     183           0 :   flag.advance(it);
     184           0 :   return RFA::CONT;
     185             : }
     186             : 
     187             : // -----------------------------------------------------------------------
     188             : // RFAFlagCubeBase::iterFlag
     189             : // Advance flag lattice and copy out flags
     190             : // -----------------------------------------------------------------------
     191           0 : void RFAFlagCubeBase::iterFlag (uInt it)
     192             : {
     193           0 :   flag.advance(it);
     194           0 :   flag.setMSFlags(it);
     195           0 : }
     196             : 
     197             : 
     198           0 : RFA::IterMode RFAFlagCubeBase::endData ()
     199             : {
     200           0 :   flag.printStats();
     201           0 :   return RFA::STOP;
     202             : }
     203             : 
     204           0 : RFA::IterMode RFAFlagCubeBase::endDry ()
     205             : {
     206           0 :   flag.printStats();
     207           0 :   return RFA::STOP;
     208             : }
     209             : 
     210             : } //# NAMESPACE CASA - END
     211             : 

Generated by: LCOV version 1.16