RFATimeFreqCrop.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
00028 #ifndef FLAGGING_RFATIMEFREQCROP_H
00029 #define FLAGGING_RFATIMEFREQCROP_H
00030
00031 #include <flagging/Flagging/RFAFlagCubeBase.h>
00032 #include <flagging/Flagging/RFDataMapper.h>
00033 #include <flagging/Flagging/RFFlagCube.h>
00034 #include <flagging/Flagging/RFRowClipper.h>
00035 #include <flagging/Flagging/RFABase.h>
00036 #include <casa/Arrays/Vector.h>
00037 #include <scimath/Functionals/Polynomial.h>
00038 #include <scimath/Fitting.h>
00039 #include <scimath/Fitting/LinearFit.h>
00040 #include <scimath/Fitting/GenericL2Fit.h>
00041 #include <scimath/Mathematics/MedianSlider.h>
00042 #include <msvis/MSVis/VisibilityIterator.h>
00043 #include <msvis/MSVis/VisBuffer.h>
00044
00045 namespace casa {
00046
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 class RFATimeFreqCrop : public RFAFlagCubeBase, public RFDataMapper
00076 {
00077 public:
00078 RFATimeFreqCrop ( RFChunkStats &ch,const RecordInterface &parm );
00079 virtual ~RFATimeFreqCrop ();
00080
00081 virtual Bool newChunk (Int &i);
00082 virtual void endChunk ();
00083 virtual void startData (bool verbose);
00084 virtual IterMode iterTime (uInt itime);
00085 virtual IterMode iterRow (uInt irow);
00086 virtual IterMode endData ();
00087 virtual void startFlag (bool verbose);
00088 virtual void iterFlag(uInt itime);
00089 static const RecordInterface & getDefaults ();
00090
00091 private:
00092
00093 Float UMean(Vector<Float> vect, Vector<Bool> flag);
00094 Float UStd(Vector<Float> vect, Vector<Bool> flag, Vector<Float> fit);
00095 Float UStd(Vector<Float> vect, Vector<Bool> flag, Float mean);
00096 void CleanBand(Vector<Float> data,Vector<Float> fit);
00097 void PolyFit(Vector<Float> data,Vector<Bool> flag, Vector<Float> fit, uInt lim1, uInt lim2,uInt deg);
00098 void LineFit(Vector<Float> data,Vector<Bool> flag, Vector<Float> fit, uInt lim1, uInt lim2);
00099 void Ants(uInt bs, uInt *a1, uInt *a2);
00100 uInt BaselineIndex(uInt row, uInt a1, uInt a2);
00101
00102 void Display_ds9(Int xdim, Int ydim, Matrix<Float> &data, Int frame);
00103 void Plot_ds9(Int dim, Vector<Float> data1, Vector<Float> data2);
00104
00105 void AllocateMemory();
00106 void FlagZeros();
00107 void RunTFCrop();
00108 void FlagTimeSeries(uInt pl, uInt bs);
00109 void FitCleanBandPass(uInt pl, uInt bs);
00110 void FlagBandPass(uInt pl, uInt bs);
00111 void GrowFlags(uInt pl, uInt bs);
00112 RFA::IterMode ShowFlagPlots();
00113 void ExtendFlags();
00114 void FillChunkFlags();
00115
00116 uInt itime;
00117 VisibilityIterator &vi;
00118 VisBuffer &vb;
00119 uInt TimeStamps;
00120 String msname;
00121 Vector<Int> ant1,ant2;
00122
00123 Cube <Complex> *vv;
00124 Cube <Complex> vc;
00125 Cube <Bool> ff;
00126 Vector <Bool> fr;
00127 Cube<Float> visc;
00128 Cube<Bool> flagc;
00129 Cube<Float> meanBP;
00130 Cube<Float> cleanBP;
00131 Vector<Bool> rowflags;
00132 Vector<Bool> baselineflags;
00133
00134 Cube<Bool> chunkflags;
00135
00136 Vector<Float> tempBP;
00137 Vector<Float> tempTS;
00138 Vector<Bool> flagBP;
00139 Vector<Bool> flagTS;
00140 Vector<Float> fitBP;
00141 Vector<Float> fitTS;
00142
00143 Float T_TOL,F_TOL,ANT_TOL,BASELN_TOL;
00144 uInt FlagLevel,CorrChoice,NumTime,MaxNPieces;
00145 Bool ShowPlots,DryRun,IgnorePreflags;
00146 uInt nPol;
00147 Bool FreqLineFit;
00148 Bool StopAndExit;
00149 String Column;
00150 Vector<String> Expr;
00151
00152 Matrix<Bool> RowFlags;
00153
00154 IPosition cubepos,matpos;
00155
00156 uInt passcnt;
00157 uInt iterRowcnt;
00158 uInt iterTimecnt;
00159 uInt timecnt;
00160
00161 uInt NumT;
00162 uInt NumB;
00163 uInt NumAnt;
00164 uInt NumC;
00165 uInt NumP;
00166
00167 FlagCubeIterator flag_iter;
00168 };
00169
00170
00171
00172 }
00173
00174 #ifndef AIPS_NO_TEMPLATE_SRC
00175 #include <flagging/Flagging/RFATimeFreqCrop.tcc>
00176 #endif //# AIPS_NO_TEMPLATE_SRC
00177 #endif