Line data Source code
1 : //# RFAFlagExaminer.h: this defines RFAFlagExaminer 2 : //# Copyright (C) 2000,2001 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 : #ifndef FLAGGING_RFAFLAGEXAMINER_H 28 : #define FLAGGING_RFAFLAGEXAMINER_H 29 : 30 : #include <flagging/Flagging/RFAFlagCubeBase.h> 31 : #include <flagging/Flagging/RFASelector.h> 32 : #include <flagging/Flagging/RFDataMapper.h> 33 : #include <casacore/casa/Arrays/LogiVector.h> 34 : 35 : namespace casa { //# NAMESPACE CASA - BEGIN 36 : 37 : // <summary> 38 : // RFAFlagExaminer: Examine the flags and get statistics. perform extensions too. 39 : // </summary> 40 : 41 : // <use visibility=local> 42 : 43 : // <reviewed reviewer="" date="" tests="" demos=""> 44 : // </reviewed> 45 : 46 : // <prerequisite> 47 : // <li> RFASelector 48 : // </prerequisite> 49 : // 50 : // <etymology> 51 : // RedFlaggerAgent Selector 52 : // </etymology> 53 : // 54 : // <synopsis> 55 : // RFAFlagExaminer accepts a whole bunch of options to select a subset of the 56 : // casacore::MS (by time, antenna, baseline, channel/frequency, etc.), and to flag/unflag 57 : // the whole selection, or specific parts of it (autocorrelations, specific 58 : // time slots, VLA quacks, etc.) 59 : // </synopsis> 60 : // 61 : // <todo asof="2001/04/16"> 62 : // <li> add this feature 63 : // <li> fix this bug 64 : // <li> start discussion of this possible extension 65 : // </todo> 66 : 67 : class RFAFlagExaminer : public RFASelector 68 : { 69 : public: 70 : // constructor. 71 : RFAFlagExaminer ( RFChunkStats &ch,const casacore::RecordInterface &parm ); 72 : virtual ~RFAFlagExaminer (); 73 : 74 : virtual void iterFlag( casacore::uInt it ); 75 : virtual IterMode iterRow( casacore::uInt irow ); 76 : virtual casacore::Bool newChunk(casacore::Int &maxmem); 77 : virtual void endChunk(); 78 : 79 : 80 0 : virtual void startData(bool verbose){RFAFlagCubeBase::startData(verbose);return;}; 81 : virtual void startFlag(bool verbose); 82 : virtual void endFlag(); 83 : virtual void finalize(); 84 : virtual void initialize(); 85 : virtual void initializeIter(casacore::uInt it); 86 : virtual void finalizeIter(casacore::uInt it); 87 0 : virtual casacore::String getID() {return casacore::String("FlagExaminer");}; 88 : 89 : virtual casacore::Record getResult(); 90 : 91 : // virtual casacore::String getDesc (); 92 : // static const casacore::RecordInterface & getDefaults (); 93 : 94 : private: 95 : void processRow ( casacore::uInt ifr,casacore::uInt it ) ; 96 : casacore::uInt64 totalflags,totalcount; 97 : casacore::uInt64 totalrowflags,totalrowcount; 98 : 99 : // accumulated over all chunks 100 : casacore::uInt64 101 : accumTotalFlags, accumTotalCount, /* accumRowFlags, */ 102 : accumTotalRowCount, accumTotalRowFlags; 103 : 104 : // per chunk 105 : casacore::uInt64 inTotalFlags, inTotalCount, inTotalRowFlags, inTotalRowCount; 106 : casacore::uInt64 outTotalFlags, outTotalCount, outTotalRowFlags, outTotalRowCount; 107 : 108 : // Statistics per antenna, baseline, spw, etc. 109 : // These maps of maps is used e.g. like: 110 : // 111 : // accumflags["baseline"]["2&&7"] == 42 112 : // accumflags["spw" ]["0" ] == 17 113 : // 114 : // which means that there were 42 flags on baseline 2 - 7, etc. 115 : std::map<std::string, std::map<std::string, casacore::uInt64> > accumflags; 116 : std::map<std::string, std::map<std::string, casacore::uInt64> > accumtotal; 117 : 118 : std::vector<casacore::uInt64> accumflags_channel; 119 : std::vector<casacore::uInt64> accumtotal_channel; 120 : std::vector<casacore::uInt64> accumflags_correlation; 121 : std::vector<casacore::uInt64> accumtotal_correlation; 122 : 123 : }; 124 : 125 : } //# NAMESPACE CASA - END 126 : 127 : #ifndef AIPS_NO_TEMPLATE_SRC 128 : #include <flagging/Flagging/RFAFlagExaminer.tcc> 129 : #endif //# AIPS_NO_TEMPLATE_SRC 130 : #endif