casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
RFAFlagExaminer.h
Go to the documentation of this file.
00001 //# RFAFlagExaminer.h: this defines RFAFlagExaminer
00002 //# Copyright (C) 2000,2001
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id$
00027 #ifndef FLAGGING_RFAFLAGEXAMINER_H
00028 #define FLAGGING_RFAFLAGEXAMINER_H
00029 
00030 #include <flagging/Flagging/RFAFlagCubeBase.h> 
00031 #include <flagging/Flagging/RFASelector.h> 
00032 #include <flagging/Flagging/RFDataMapper.h>
00033 #include <casa/Arrays/LogiVector.h>
00034     
00035 namespace casa { //# NAMESPACE CASA - BEGIN
00036 
00037 // <summary>
00038 // RFAFlagExaminer: Examine the flags and get statistics. perform extensions too.
00039 // </summary>
00040 
00041 // <use visibility=local>
00042 
00043 // <reviewed reviewer="" date="" tests="" demos="">
00044 // </reviewed>
00045 
00046 // <prerequisite>
00047 //   <li> RFASelector
00048 // </prerequisite>
00049 //
00050 // <etymology>
00051 // RedFlaggerAgent Selector
00052 // </etymology>
00053 //
00054 // <synopsis>
00055 // RFAFlagExaminer accepts a whole bunch of options to select a subset of the
00056 // MS (by time, antenna, baseline, channel/frequency, etc.), and to flag/unflag 
00057 // the whole selection, or specific parts of it (autocorrelations, specific 
00058 // time slots, VLA quacks, etc.)
00059 // </synopsis>
00060 //
00061 // <todo asof="2001/04/16">
00062 //   <li> add this feature
00063 //   <li> fix this bug
00064 //   <li> start discussion of this possible extension
00065 // </todo>
00066 
00067 class RFAFlagExaminer : public RFASelector
00068 {
00069 public:
00070 // constructor. 
00071   RFAFlagExaminer ( RFChunkStats &ch,const RecordInterface &parm ); 
00072   virtual ~RFAFlagExaminer ();
00073   
00074   virtual void iterFlag( uInt it );
00075   virtual IterMode iterRow( uInt irow );
00076   virtual Bool newChunk(Int &maxmem);
00077   virtual void endChunk();
00078 
00079 
00080   virtual void startData(bool verbose){RFAFlagCubeBase::startData(verbose);return;};
00081   virtual void startFlag(bool verbose);
00082   virtual void endFlag();
00083   virtual void finalize();
00084   virtual void initialize();
00085   virtual void initializeIter(uInt it);
00086   virtual void finalizeIter(uInt it);
00087   virtual String getID() {return String("FlagExaminer");};
00088 
00089   virtual Record getResult();
00090 
00091 //  virtual String getDesc ();
00092 //  static const RecordInterface & getDefaults ();
00093 
00094 private:
00095     void processRow  ( uInt ifr,uInt it ) ;
00096     uInt64 totalflags,totalcount;
00097     uInt64 totalrowflags,totalrowcount;
00098 
00099     // accumulated over all chunks
00100     uInt64 
00101       accumTotalFlags, accumTotalCount, accumRowFlags, 
00102       accumTotalRowCount, accumTotalRowFlags;
00103 
00104     // per chunk
00105     uInt64 inTotalFlags, inTotalCount, inTotalRowFlags, inTotalRowCount;
00106     uInt64 outTotalFlags, outTotalCount, outTotalRowFlags, outTotalRowCount;
00107     
00108     // Statistics per antenna, baseline, spw, etc.
00109     // These maps of maps is used e.g. like:
00110     //
00111     //        accumflags["baseline"]["2&&7"] == 42
00112     //        accumflags["spw"     ]["0"   ] == 17
00113     //
00114     // which means that there were 42 flags on baseline 2 - 7, etc.
00115     std::map<std::string, std::map<std::string, uInt64> > accumflags;
00116     std::map<std::string, std::map<std::string, uInt64> > accumtotal;
00117     
00118     std::vector<uInt64> accumflags_channel;
00119     std::vector<uInt64> accumtotal_channel;
00120     std::vector<uInt64> accumflags_correlation;
00121     std::vector<uInt64> accumtotal_correlation;
00122 
00123 };
00124 
00125 } //# NAMESPACE CASA - END
00126 
00127 #ifndef AIPS_NO_TEMPLATE_SRC
00128 #include <flagging/Flagging/RFAFlagExaminer.tcc>
00129 #endif //# AIPS_NO_TEMPLATE_SRC
00130 #endif