RFChunkStats.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef FLAGGING_RFCHUNKSTATS_H
00028 #define FLAGGING_RFCHUNKSTATS_H
00029
00030 #include <measures/Measures/Stokes.h>
00031 #include <casa/Arrays/Vector.h>
00032 #include <casa/Arrays/Matrix.h>
00033 #include <casa/Arrays/Cube.h>
00034 #include <casa/Containers/Block.h>
00035 #include <lattices/Lattices/LatticeIterator.h>
00036 #include <flagging/Flagging/RFCommon.h>
00037
00038 namespace casa {
00039
00040 class Flagger;
00041 class MeasurementSet;
00042 class VisibilityIterator;
00043 class VisBuffer;
00044
00045 class RFABase;
00046 typedef RFABase RFA;
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085 class RFChunkStats : public FlaggerEnums
00086 {
00087 protected:
00088 VisibilityIterator &visiter;
00089 VisBuffer &visbuf;
00090 Flagger &flagger;
00091
00092 IPosition visshape;
00093 uInt counts[Num_StatEnums];
00094 Matrix<uInt> nf_ifr_time,nf_chan_ifr;
00095 Vector<uInt> rows_per_ifr;
00096 Vector<uInt> nrf_ifr,nrf_time;
00097 Vector<Int> ifr_nums;
00098 Vector<Int> feed_nums;
00099 Vector<Int> corrtypes;
00100 Vector<Double> freq;
00101 String corr_string;
00102 Double start_time,end_time,current_time;
00103 uInt chunk_no,pass_no;
00104 Int itime;
00105
00106
00107
00108 std::vector<double> scan_start;
00109 std::vector<double> scan_start_flag;
00110
00111 std::vector<double> scan_end, scan_end_flag;
00112
00113
00114
00115 public:
00116
00117 RFChunkStats( VisibilityIterator &vi,VisBuffer &vb,Flagger &rf );
00118
00119
00120 const VisibilityIterator & visIter () const { return visiter; }
00121 VisibilityIterator & visIter () { return visiter; }
00122
00123 VisBuffer &visBuf () { return visbuf; }
00124
00125 const MeasurementSet & measSet () const;
00126
00127 const String msName () const;
00128
00129 const Vector<String> & antNames () const;
00130
00131
00132 double get_scan_start(unsigned scan) const
00133 { return scan_start[scan]; }
00134
00135 double get_scan_end(unsigned scan) const
00136 { return scan_end[scan]; }
00137
00138
00139
00140
00141
00142
00143 double get_scan_start_unflagged(unsigned scan) const
00144 { return scan_start_flag[scan]; }
00145
00146 double get_scan_end_unflagged(unsigned scan) const
00147 { return scan_end_flag[scan]; }
00148
00149
00150 void newChunk (bool init_quack);
00151
00152 void newPass (uInt npass);
00153
00154 void newTime ();
00155
00156
00157 uInt nchunk() const { return chunk_no; };
00158
00159 uInt npass() const { return pass_no; };
00160
00161 Int iTime() const { return itime; };
00162
00163
00164 uInt num ( StatEnums which ) const { return counts[which]; }
00165
00166 const Vector<Double> & frequency ();
00167
00168
00169 Double currentMJD () const
00170 { return current_time; }
00171
00172 Double startMJD () const
00173 { return start_time; }
00174
00175 Double endMJD () const
00176 { return end_time; }
00177
00178
00179
00180 template<class T> RFlagWord getCorrMask ( const Vector<T> &corrspec );
00181
00182
00183 RFlagWord fullCorrMask () { return (1<<num(CORR))-1; };
00184
00185 const String & getCorrString () { return corr_string; }
00186
00187
00188 uInt ifrNum( uInt nr ) { return ifr_nums(nr); };
00189
00190 const Vector<Int> & ifrNums () { return ifr_nums; };
00191
00192
00193 uInt feedNum( uInt nr ) { return feed_nums(nr); };
00194
00195 const Vector<Int> & feedNums () { return feed_nums; };
00196
00197
00198 uInt antToIfr ( uInt ant1,uInt ant2 );
00199
00200 void ifrToAnt ( uInt &ant1,uInt &ant2,uInt ifr );
00201
00202 String ifrString ( uInt ifr );
00203
00204
00205 uInt nrowPerIfr ( uInt ifr ) { return rows_per_ifr(ifr); }
00206 const Vector<uInt> & nrowPerIfr () const { return rows_per_ifr; }
00207
00208
00209 uInt & nfIfrTime ( uInt ifr,uInt itime )
00210 { return nf_ifr_time(ifr,itime); }
00211 const Matrix<uInt> & nfIfrTime () const
00212 { return nf_ifr_time; }
00213 uInt & nfChanIfr ( uInt ich,uInt ifr )
00214 { return nf_chan_ifr(ich,ifr); }
00215 const Matrix<uInt> & nfChanIfr () const
00216 { return nf_chan_ifr; }
00217 Matrix<uInt> & nfChanIfr ()
00218 { return nf_chan_ifr; }
00219 uInt & nrfIfr (uInt i)
00220 { return nrf_ifr(i); }
00221 uInt & nrfTime (uInt i)
00222 { return nrf_time(i); }
00223 const Vector<uInt> & nrfIfr () const
00224 { return nrf_ifr; };
00225 const Vector<uInt> & nrfTime () const
00226 { return nrf_time; };
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239 void printStats ();
00240 };
00241
00242
00243 const RFChunkStats::StatEnums active_stats[] = { RFChunkStats::CHAN,RFChunkStats::IFR,RFChunkStats::TIME };
00244 const uInt num_active_stats = 3;
00245
00246
00247 Int findCorrType( Stokes::StokesTypes type,const Vector<Int> &corr );
00248
00249
00250 }
00251
00252 #ifndef AIPS_NO_TEMPLATE_SRC
00253 #include <flagging/Flagging/RFChunkStats.tcc>
00254 #endif //# AIPS_NO_TEMPLATE_SRC
00255 #endif