ExtendFlagger.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
00029
00030
00031
00032
00033
00034 #ifndef EXTENDFLAGGER_H
00035 #define EXTENDFLAGGER_H
00036
00037
00038
00039 #include <casa/aips.h>
00040 #include <casa/iostream.h>
00041 #include <casa/OS/Timer.h>
00042
00043 #include <casa/Arrays/Vector.h>
00044 #include <casa/Arrays/Array.h>
00045 #include <casa/Arrays/Matrix.h>
00046 #include <casa/Arrays/Slicer.h>
00047
00048 #include <tables/Tables/Table.h>
00049 #include <tables/Tables/ArrayColumn.h>
00050 #include <tables/Tables/ScalarColumn.h>
00051 #include <tables/Tables/TableColumn.h>
00052
00053 #include <tables/TaQL/ExprNode.h>
00054 #include <tables/TaQL/RecordGram.h>
00055
00056 #include <ms/MeasurementSets/MeasurementSet.h>
00057 #include <flagging/Flagging/Flagger.h>
00058
00059
00060 namespace casa {
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
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222 class FlagIDS {
00223 public:
00224 FlagIDS() {
00225 bl = "";
00226 field = 0;
00227 time = "";
00228 spw = "";
00229 corr = "";
00230 chan = "";
00231 }
00232
00233 String bl;
00234 uInt field;
00235 String time;
00236 String spw;
00237 String corr;
00238 String chan;
00239
00240 FlagIDS &operator=(const FlagIDS &other) {
00241 bl = other.bl;
00242 field = other.field;
00243 time = other.time;
00244 spw = other.spw;
00245 corr = other.corr;
00246 chan = other.chan;
00247 return *this;
00248 }
00249
00250 static int compareID (const void* val1, const void* val2);
00251
00252 void show() {
00253 cout
00254 << " time=" << time
00255 << " bl=" << bl
00256 << " field=" << field
00257 << " spw=" << spw
00258 << " corr=" << corr
00259 << " chan=" << chan
00260 << endl;
00261 }
00262 };
00263
00264 class FlagID {
00265 public:
00266 FlagID() {
00267 rowNum = 0;
00268
00269 ant1 = 0;
00270 ant2 = 0;
00271 field = 0;
00272 time = "";
00273 spw = 0;
00274 corr = "";
00275 chan = "";
00276 polid = 0;
00277 }
00278
00279 uInt rowNum;
00280
00281 uInt ant1;
00282 uInt ant2;
00283 uInt field;
00284 String time;
00285 uInt spw;
00286 String corr;
00287 String chan;
00288 uInt polid;
00289
00290 FlagID &operator=(const FlagID &other) {
00291 rowNum = other.rowNum;
00292
00293 ant1 = other.ant1;
00294 ant2 = other.ant2;
00295 field = other.field;
00296 time = other.time;
00297 spw = other.spw;
00298 corr = other.corr;
00299 chan = other.chan;
00300 polid = other.polid;
00301 return *this;
00302 }
00303
00304 static int compare (const void* val1, const void* val2);
00305
00306 void show() {
00307 cout << "rowNum=" << rowNum
00308
00309 << " ant1=" << ant1
00310 << " ant2=" << ant2
00311 << " field=" << field
00312 << " time=" << time
00313 << " spw=" << spw
00314 << " corr=" << corr
00315 << " chan=" << chan
00316 << " polid=" << polid
00317 << endl;
00318 }
00319 };
00320
00321 class ExtendFlagger
00322 {
00323 public:
00324
00325 ExtendFlagger();
00326 ExtendFlagger(MeasurementSet& ms, const String& exchan,
00327 const String& excorr, const String& exant,
00328 const String& exspw, const String& time,
00329 const Vector<Vector<String> >& corrs, const Vector<Int>& chans);
00330
00331
00332 virtual ~ExtendFlagger();
00333
00334
00335
00336 ExtendFlagger& operator=(const ExtendFlagger&){return *this;}
00337
00338 Bool attach(MeasurementSet &ms);
00339 void detach();
00340
00341 Bool initdata(const String& field = "", const String& spw = "",
00342 const String& array = "", const String& feed = "",
00343 const String& scan = "", const String& baseline = "",
00344 const String& uvrange = "", const String& time = "",
00345 const String& correlation = "", const String& intent = "");
00346
00347 Bool setdata();
00348
00349 Bool selectdata(Bool useoriginalms = True);
00350
00351 Bool setmanualflags(Bool unflag = False,
00352 Bool autocorr = False);
00353
00354 Bool run(Bool trial = False, Bool reset = False);
00355
00356 Bool extend(const Vector<FlagID>& flagids);
00357 Bool extend2(const Vector<FlagID>& flagids);
00358
00359 void setField(const String& field);
00360 void setSpw(const String& spw);
00361 void setArray(const String& array);
00362 void setFeed(const String& feed);
00363 void setScan(const String& scan);
00364 void setBaseline(const String& baseline);
00365 void setUvrange(const String& uvrange);
00366 void setTime(const String& time);
00367 void setCorrelation(const String& correlation);
00368 void setIntent(const String& intent);
00369 void setUnflag(Bool unflg);
00370
00371 void setExtendChan(const String& exchan);
00372 void setExtendCorr(const String& excorr);
00373 void setExtendSpw(const String& exspw);
00374 void setExtendTime(const String& extime);
00375 void setExtendAnt(const String& exant);
00376 void setExtend(const String& exchan, const String& excorr,
00377 const String& exspw, const String& exant,
00378 const String& extime,
00379 const Vector<Vector<String> >& corrs, const Vector<Int>& chans);
00380 void setAbleCorr(const Vector<Vector<String> >& corrName);
00381 void setChanNum(const Vector<Int>& chanNum);
00382 String halfExtendCorr(const String& corr, const uInt polid = 0);
00383 String ableSpw(const Int spw);
00384 void show();
00385 private:
00386
00387 Flagger flagger;
00388 Bool useoriginalms;
00389
00390 String field;
00391 String spw;
00392 String array;
00393 String feed;
00394 String scan;
00395 String baseline;
00396 String uvrange;
00397 String time;
00398 String correlation;
00399 String intent;
00400
00401 String clipexpr;
00402 Vector<Double> cliprange;
00403 String clipcolumn;
00404 Bool outside;
00405 Bool channelavg;
00406 Double quackinterval;
00407 String opmode;
00408
00409 Bool unflag;
00410
00411 String extendChan;
00412 String extendCorr;
00413 String extendSpw;
00414 String extendAnt;
00415 String extendTime;
00416
00417 Vector<Vector<String> > ableCorr;
00418 Vector<Int> chanNum;
00419
00420 };
00421
00422 }
00423
00424
00425
00426
00427 #endif
00428