00001
00002
00003
00004
00005
00006
00007
00008
00009 from sys import version_info
00010 if version_info >= (2,6,0):
00011 def swig_import_helper():
00012 from os.path import dirname
00013 import imp
00014 fp = None
00015 try:
00016 fp, pathname, description = imp.find_module('_agentflagger', [dirname(__file__)])
00017 except ImportError:
00018 import _agentflagger
00019 return _agentflagger
00020 if fp is not None:
00021 try:
00022 _mod = imp.load_module('_agentflagger', fp, pathname, description)
00023 finally:
00024 fp.close()
00025 return _mod
00026 _agentflagger = swig_import_helper()
00027 del swig_import_helper
00028 else:
00029 import _agentflagger
00030 del version_info
00031 try:
00032 _swig_property = property
00033 except NameError:
00034 pass
00035 def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
00036 if (name == "thisown"): return self.this.own(value)
00037 if (name == "this"):
00038 if type(value).__name__ == 'SwigPyObject':
00039 self.__dict__[name] = value
00040 return
00041 method = class_type.__swig_setmethods__.get(name,None)
00042 if method: return method(self,value)
00043 if (not static):
00044 self.__dict__[name] = value
00045 else:
00046 raise AttributeError("You cannot add attributes to %s" % self)
00047
00048 def _swig_setattr(self,class_type,name,value):
00049 return _swig_setattr_nondynamic(self,class_type,name,value,0)
00050
00051 def _swig_getattr(self,class_type,name):
00052 if (name == "thisown"): return self.this.own()
00053 method = class_type.__swig_getmethods__.get(name,None)
00054 if method: return method(self)
00055 raise AttributeError(name)
00056
00057 def _swig_repr(self):
00058 try: strthis = "proxy of " + self.this.__repr__()
00059 except: strthis = ""
00060 return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
00061
00062 try:
00063 _object = object
00064 _newclass = 1
00065 except AttributeError:
00066 class _object : pass
00067 _newclass = 0
00068
00069
00070 class agentflagger(_object):
00071 """Proxy of C++ casac::agentflagger class"""
00072 __swig_setmethods__ = {}
00073 __setattr__ = lambda self, name, value: _swig_setattr(self, agentflagger, name, value)
00074 __swig_getmethods__ = {}
00075 __getattr__ = lambda self, name: _swig_getattr(self, agentflagger, name)
00076 __repr__ = _swig_repr
00077 def __init__(self):
00078 """__init__(self) -> agentflagger"""
00079 this = _agentflagger.new_agentflagger()
00080 try: self.this.append(this)
00081 except: self.this = this
00082 __swig_destroy__ = _agentflagger.delete_agentflagger
00083 __del__ = lambda self : None;
00084 def done(self):
00085 """
00086 done(self) -> bool
00087
00088 Summary
00089 Destroy the flag tool
00090 --------------------------------------------------------------------------------
00091
00092 """
00093 return _agentflagger.agentflagger_done(self)
00094
00095 def open(self, *args, **kwargs):
00096 """
00097 open(self, msname=string(""), ntime=0.0) -> bool
00098
00099 Summary
00100 Open the MS or a calibration table and attach it to the tool.
00101
00102 Input Parameters:
00103 msname Measurement set or calibration table to be processed. Default:
00104 ntime Time interval. If not given, the default will be used. Default: 0.0
00105
00106 --------------------------------------------------------------------------------
00107
00108 """
00109 return _agentflagger.agentflagger_open(self, *args, **kwargs)
00110
00111 def selectdata(self, *args, **kwargs):
00112 """
00113 selectdata(self, config=initialize_record(""), field=string(""), spw=string(""), array=string(""),
00114 feed=string(""), scan=string(""), antenna=string(""), uvrange=string(""),
00115 time=string(""), correlation=string(""), intent=string(""), observation=string("")) -> bool
00116
00117 Summary
00118 Select the data based on the given parameters.
00119 For unspecified parameters, the full data range is assumed.
00120 All data selection parameters follow the MS Selection syntax.
00121
00122
00123 Input Parameters:
00124 config The record (dictionary) config may be given or not. If it is not given,
00125 and no specific parameter is given either, the whole MS will be selected. The record
00126 may contain any data selection parameters supported by MS Selection such as:
00127
00128 field Field indices or source names : example : '2,3C48'
00129 spw Spectral Window Indices or names : example : '1,2'
00130 array Array Indices or names : example : 'VLAA'
00131 feed Feed index or name : example : '1,2' (not supported yet)
00132 scan Scan number : example : '1,2,3'
00133 antenna Baseline number : example : '2-3,4-5,132 ????'
00134 uvrange UV-distance range, with a unit : example : '2.0-3000.0 m'
00135 time Time range, as MJDs or date strings : example : 'xx.x.x.x.x~yy.y.y.y.y'
00136 correlation Correlations/polarizations : example : 'RR,LL,RL,LR,XX,YY,XY,YX,Sol1'
00137 intent Scan intent : example : '*CAL*, *BAND*'
00138 observation Observation Id : example : '2~4'
00139
00140 --------------------------------------------------------------------------------
00141
00142 """
00143 return _agentflagger.agentflagger_selectdata(self, *args, **kwargs)
00144
00145 def parseagentparameters(self, *args, **kwargs):
00146 """
00147 parseagentparameters(self, aparams) -> bool
00148
00149 Summary
00150 Parse the parameters for the agent (flagging mode).
00151
00152 Input Parameters:
00153 aparams It takes a record (dictionary) with the specific parameters for the flagging mode.
00154 The record may contain any data selection parameters supported by MS Selection, as well as
00155 mode-specific parameters such as:
00156
00157 (1) array,feed,scan,field,spw,intent,correlation,antenna,uvrange,observation
00158 (2) mode (which can be: manual,clip,quack,shadow,elevation,tfcrop,extendflags,unflag or summary)
00159 For flagging mode=clip, the parameters are: expression, datacolumns, clipminmax, etc.
00160 See the documentation of the task tflagger for all the available parameters for each mode.
00161
00162 (3) apply: default is true (true for flagging and false for unflagging)
00163 Example:
00164
00165 myrecord={}
00166 myrecord['mode']='clip'
00167 myrecord['scan']='1~3'
00168 myrecord['clipminmax']=[0.02,0.3]
00169 myrecord['apply']=True
00170 af.parseagentparameters(myrecord)
00171
00172
00173 --------------------------------------------------------------------------------
00174
00175 """
00176 return _agentflagger.agentflagger_parseagentparameters(self, *args, **kwargs)
00177
00178 def init(self):
00179 """
00180 init(self) -> bool
00181
00182 Summary
00183 Initialize the agents
00184 --------------------------------------------------------------------------------
00185
00186 """
00187 return _agentflagger.agentflagger_init(self)
00188
00189 def run(self, writeflags=True, sequential=True):
00190 """
00191 run(self, writeflags=True, sequential=True) -> record *
00192
00193 Summary
00194 Execute a list of flagging agents
00195
00196 Input Parameters:
00197 writeflags Write flags to MS true
00198 sequential Run the task in sequential or in parallel. true
00199
00200 --------------------------------------------------------------------------------
00201
00202 """
00203 return _agentflagger.agentflagger_run(self, writeflags, sequential)
00204
00205 def getflagversionlist(self, printflags=True):
00206 """
00207 getflagversionlist(self, printflags=True) -> std::vector< std::string >
00208
00209 Summary
00210 Print out a list of saved flag_versions.
00211
00212 Input Parameters:
00213 printflags Print flagversions in logger? true
00214
00215 --------------------------------------------------------------------------------
00216
00217 """
00218 return _agentflagger.agentflagger_getflagversionlist(self, printflags)
00219
00220 def printflagselection(self):
00221 """
00222 printflagselection(self) -> bool
00223
00224 Summary
00225 Print out a list of current flag selections.
00226
00227 --------------------------------------------------------------------------------
00228
00229 """
00230 return _agentflagger.agentflagger_printflagselection(self)
00231
00232 def saveflagversion(self, *args, **kwargs):
00233 """
00234 saveflagversion(self, versionname=string(""), comment=string(""), merge=string("")) -> bool
00235
00236 Summary
00237 Save current flags with a version name.
00238
00239
00240 Input Parameters:
00241 versionname Version name
00242 comment Comment for this flag table
00243 merge merge type
00244
00245 --------------------------------------------------------------------------------
00246
00247 """
00248 return _agentflagger.agentflagger_saveflagversion(self, *args, **kwargs)
00249
00250 def restoreflagversion(self, *args, **kwargs):
00251 """
00252 restoreflagversion(self, versionname=std::vector< string >(1, ""), merge=string("")) -> bool
00253
00254 Summary
00255 Restore flags from a saved flag_version.
00256 n versionname : name of flag version to restore to main table
00257 n merge : Type of operation to perform during restoration.
00258 n merge = replace : replaces the main table flags.
00259 n merge = and : logical AND with main table flags
00260 n merge = or : logical OR with main table flags
00261 n Default : replace.
00262 n
00263
00264
00265 Input Parameters:
00266 versionname Version name
00267 merge merge type
00268
00269 --------------------------------------------------------------------------------
00270
00271 """
00272 return _agentflagger.agentflagger_restoreflagversion(self, *args, **kwargs)
00273
00274 def deleteflagversion(self, *args, **kwargs):
00275 """
00276 deleteflagversion(self, versionname=std::vector< string >(1, "")) -> bool
00277
00278 Summary
00279 Delete a saved flag_version.
00280
00281 Input Parameters:
00282 versionname Version name
00283
00284 --------------------------------------------------------------------------------
00285
00286 """
00287 return _agentflagger.agentflagger_deleteflagversion(self, *args, **kwargs)
00288
00289 def parsemanualparameters(self, *args, **kwargs):
00290 """
00291 parsemanualparameters(self, field=string(""), spw=string(""), array=string(""), feed=string(""), scan=string(""),
00292 antenna=string(""), uvrange=string(""), time=string(""), correlation=string(""),
00293 intent=string(""), observation=string(""), autocorr=False, apply=True) -> bool
00294
00295 Summary
00296 Parse data selection parameters and specific parameters
00297 for the manual mode.
00298
00299
00300 Input Parameters:
00301 field Field indices or source names. Example: '2,3C48'
00302 spw Spectral Window Indices or names. Example: '1,2'
00303 array Array Indices or names. Example: 'VLAA'
00304 feed Feed index or name. Eexample: '1,2' (not supported yet)
00305 scan Scan number. Example: '1,2,3'
00306 antenna Baseline number. Example: '2-3,4-5,132 ????'
00307 uvrange UV-distance range, with a unit. Example: '2.0-3000.0 m'
00308 time Time range, as MJDs or date strings. Example: 'xx.x.x.x.x~yy.y.y.y.y'
00309 correlation Correlations/polarizations. Example: 'RR,LL,RL,LR,XX,YY,XY,YX'
00310 intent Scan intent. Example: '*CAL*, *BAND*'
00311 observation Observation Id. Example: '2~4'
00312 autocorr Parameter to flag only auto-correlations. Default: false
00313 apply Parameter to flag or unflag the data. Default: true
00314
00315 --------------------------------------------------------------------------------
00316
00317 """
00318 return _agentflagger.agentflagger_parsemanualparameters(self, *args, **kwargs)
00319
00320 def parseclipparameters(self, *args, **kwargs):
00321 """
00322 parseclipparameters(self, field=string(""), spw=string(""), array=string(""), feed=string(""), scan=string(""),
00323 antenna=string(""), uvrange=string(""), time=string(""), correlation=string(""),
00324 intent=string(""), observation=string(""), datacolumn=string("DATA"),
00325 clipminmax=std::vector< double >(), clipoutside=True, channelavg=False,
00326 clipzeros=False, apply=True) -> bool
00327
00328 Summary
00329 Parse data selection parameters and specific parameters
00330 for the clip mode.
00331
00332
00333 Input Parameters:
00334 field Field indices or source names. Example: '2,3C48'
00335 spw Spectral Window Indices or names. Example: '1,2'
00336 array Array Indices or names. Example: 'VLAA'
00337 feed Feed index or name. Eexample: '1,2' (not supported yet)
00338 scan Scan number. Example: '1,2,3'
00339 antenna Baseline number. Example: '2-3,4-5,132 ????'
00340 uvrange UV-distance range, with a unit. Example: '2.0-3000.0 m'
00341 time Time range, as MJDs or date strings. Example: 'xx.x.x.x.x~yy.y.y.y.y'
00342 correlation Correlations/polarizations. Example: 'RR,LL,RL,LR,XX,YY,XY,YX'
00343 intent Scan intent. Example: '*CAL*, *BAND*'
00344 observation Observation Id. Example: '2~4'
00345 datacolumn Data column to use for clipping. Supported columns for cal tables are FPARAM,CPARAM,SNR. Example: 'DATA'. Default: DATA
00346 clipminmax Range to use for clipping. Example: [100.0,200.0]
00347 clipoutside Clip points outside this range? [True/False]. Default: true
00348 channelavg Average data over channels before clipping? [True/False]. Default: false
00349 clipzeros Clip zero-value data. [True/False]. Default: false
00350 apply Parameter to flag or unflag data. Default: true
00351
00352 --------------------------------------------------------------------------------
00353
00354 """
00355 return _agentflagger.agentflagger_parseclipparameters(self, *args, **kwargs)
00356
00357 def parsequackparameters(self, *args, **kwargs):
00358 """
00359 parsequackparameters(self, field=string(""), spw=string(""), array=string(""), feed=string(""), scan=string(""),
00360 antenna=string(""), uvrange=string(""), time=string(""), correlation=string(""),
00361 intent=string(""), observation=string(""), quackmode=string("beg"),
00362 quackinterval=0.0, quackincrement=False, apply=True) -> bool
00363
00364 Summary
00365 Parse data selection parameters and specific parameters
00366 for the quack mode.
00367
00368
00369 Input Parameters:
00370 field Field indices or source names. Example: '2,3C48'
00371 spw Spectral Window Indices or names. Example: '1,2'
00372 array Array Indices or names. Example: 'VLAA'
00373 feed Feed index or name. Eexample: '1,2' (not supported yet)
00374 scan Scan number. Example: '1,2,3'
00375 antenna Baseline number. Example: '2-3,4-5,132 ????'
00376 uvrange UV-distance range, with a unit. Example: '2.0-3000.0 m'
00377 time Time range, as MJDs or date strings. Example: 'xx.x.x.x.x~yy.y.y.y.y'
00378 correlation Correlations/polarizations. Example: 'RR,LL,RL,LR,XX,YY,XY,YX'
00379 intent Scan intent. Example: '*CAL*, *BAND*'
00380 observation Observation Id. Example: '2~4'
00381 quackmode Quack mode. Default: beg
00382 quackinterval Quack length in seconds. Default: 0.0
00383 quackincrement Flag incrementally in time. Default: false
00384 apply Parameter to flag or unflag the data. Default: true
00385
00386 --------------------------------------------------------------------------------
00387
00388 """
00389 return _agentflagger.agentflagger_parsequackparameters(self, *args, **kwargs)
00390
00391 def parseelevationparameters(self, *args, **kwargs):
00392 """
00393 parseelevationparameters(self, field=string(""), spw=string(""), array=string(""), feed=string(""), scan=string(""),
00394 antenna=string(""), uvrange=string(""), time=string(""), correlation=string(""),
00395 intent=string(""), observation=string(""), lowerlimit=0.0, upperlimit=90.0,
00396 apply=True) -> bool
00397
00398 Summary
00399 Parse data selection parameters and specific parameters
00400 for the elevation mode.
00401
00402
00403 Input Parameters:
00404 field Field indices or source names. Example: '2,3C48'
00405 spw Spectral Window Indices or names. Example: '1,2'
00406 array Array Indices or names. Example: 'VLAA'
00407 feed Feed index or name. Eexample: '1,2' (not supported yet)
00408 scan Scan number. Example: '1,2,3'
00409 antenna Baseline number. Example: '2-3,4-5,132 ????'
00410 uvrange UV-distance range, with a unit. Example: '2.0-3000.0 m'
00411 time Time range, as MJDs or date strings. Example: 'xx.x.x.x.x~yy.y.y.y.y'
00412 correlation Correlations/polarizations. Example: 'RR,LL,RL,LR,XX,YY,XY,YX'
00413 intent Scan intent. Example: '*CAL*, *BAND*'
00414 observation Observation Id. Example: '2~4'
00415 lowerlimit The limiting elevation in degrees. Data obtained at lower antenna elevations will get flagged. Default: 0.0
00416 upperlimit The limiting elevation in degrees. Data obtained at higher antenna elevations will get flagged. Default: 90.0
00417 apply Parameter to flag or unflag the data. Default: true
00418
00419 --------------------------------------------------------------------------------
00420
00421 """
00422 return _agentflagger.agentflagger_parseelevationparameters(self, *args, **kwargs)
00423
00424 def parsetfcropparameters(self, *args, **kwargs):
00425 """
00426 parsetfcropparameters(self, field=string(""), spw=string(""), array=string(""), feed=string(""), scan=string(""),
00427 antenna=string(""), uvrange=string(""), time=string(""), correlation=string(""),
00428 intent=string(""), observation=string(""), ntime=0.0, combinescans=False,
00429 datacolumn=string("DATA"), timecutoff=4.0, freqcutoff=3.0, timefit=string("line"),
00430 freqfit=string("poly"), maxnpieces=7, flagdimension=string("freqtime"),
00431 usewindowstats=string("none"), halfwin=1, apply=True) -> bool
00432
00433 Summary
00434 Parse data selection parameters and specific parameters
00435 for the time and frequency mode.
00436
00437
00438 Input Parameters:
00439 field Field indices or source names. Example: '2,3C48'
00440 spw Spectral Window Indices or names. Example: '1,2'
00441 array Array Indices or names. Example: 'VLAA'
00442 feed Feed index or name. Eexample: '1,2' (not supported yet)
00443 scan Scan number. Example: '1,2,3'
00444 antenna Baseline number. Example: '2-3,4-5,132 ????'
00445 uvrange UV-distance range, with a unit. Example: '2.0-3000.0 m'
00446 time Time range, as MJDs or date strings. Example: 'xx.x.x.x.x~yy.y.y.y.y'
00447 correlation Correlations/polarizations. Example: 'RR,LL,RL,LR,XX,YY,XY,YX'
00448 intent Scan intent. Example: '*CAL*, *BAND*'
00449 observation Observation Id. Example: '2~4'
00450 ntime Time-range to use for each chunk (in seconds or minutes) 0.0
00451 combinescans Accumulate data across scans. false
00452 datacolumn Data column to use for clipping. Example: 'DATA'. Default: DATA
00453 timecutoff Flagging thresholds in units of deviation from the fit. Default: 4.0
00454 freqcutoff Flagging thresholds in units of deviation from the fit. Default: 3.0
00455 timefit Fitting function for the time direction (poly/line). Default: line
00456 freqfit Fitting function for the frequency direction (poly/line). Default: poly
00457 maxnpieces Number of pieces in the polynomial-fits (for 'freqfit' or 'timefit' = 'poly'). Default: 7
00458 flagdimension Dimensions along which to calculate fits (freq/time/freqtime/timefreq). Default: freqtime
00459 usewindowstats Calculate additional flags using sliding window statistics (none,sum,std,both). Default: none
00460 halfwin Half-width of sliding window to use with 'usewindowstats' (1,2,3). Default: 1
00461 apply Parameter to flag or unflag the data. Default: true
00462
00463 --------------------------------------------------------------------------------
00464
00465 """
00466 return _agentflagger.agentflagger_parsetfcropparameters(self, *args, **kwargs)
00467
00468 def parseextendparameters(self, *args, **kwargs):
00469 """
00470 parseextendparameters(self, field=string(""), spw=string(""), array=string(""), feed=string(""), scan=string(""),
00471 antenna=string(""), uvrange=string(""), time=string(""), correlation=string(""),
00472 intent=string(""), observation=string(""), ntime=0.0, combinescans=False,
00473 extendpols=True, growtime=50.0, growfreq=50.0, growaround=False,
00474 flagneartime=False, flagnearfreq=False, apply=True) -> bool
00475
00476 Summary
00477 Parse data selection parameters and specific parameters
00478 for the extend mode.
00479
00480
00481 Input Parameters:
00482 field Field indices or source names. Example: '2,3C48'
00483 spw Spectral Window Indices or names. Example: '1,2'
00484 array Array Indices or names. Example: 'VLAA'
00485 feed Feed index or name. Eexample: '1,2' (not supported yet)
00486 scan Scan number. Example: '1,2,3'
00487 antenna Baseline number. Example: '2-3,4-5,132 ????'
00488 uvrange UV-distance range, with a unit. Example: '2.0-3000.0 m'
00489 time Time range, as MJDs or date strings. Example: 'xx.x.x.x.x~yy.y.y.y.y'
00490 correlation Correlations/polarizations. Example: 'RR,LL,RL,LR,XX,YY,XY,YX'
00491 intent Scan intent. Example: '*CAL*, *BAND*'
00492 observation Observation Id. Example: '2~4'
00493 ntime Time-range to use for each chunk (in seconds or minutes). Default: 0.0
00494 combinescans Accumulate data across scans.. Default: false
00495 extendpols If any correlation is flagged, flag all correlations. Default: true
00496 growtime Flag all 'ntime' integrations if more than X% of the timerange is flagged (0-100). Default: 50.0
00497 growfreq Flag all selected channels if more than X% of the frequency range is flagged(0-100). Default: 50.0
00498 growaround Flag data based on surrounding flags. Default: false
00499 flagneartime Flag one timestep before and after a flagged one. Default: false
00500 flagnearfreq Flag one channel before and after a flagged one. Default: false
00501 apply Parameter to flag or unflag the data. Default: true
00502
00503 --------------------------------------------------------------------------------
00504
00505 """
00506 return _agentflagger.agentflagger_parseextendparameters(self, *args, **kwargs)
00507
00508 def parsesummaryparameters(self, *args, **kwargs):
00509 """
00510 parsesummaryparameters(self, field=string(""), spw=string(""), array=string(""), feed=string(""), scan=string(""),
00511 antenna=string(""), uvrange=string(""), time=string(""), correlation=string(""),
00512 intent=string(""), observation=string(""), spwchan=False, spwcorr=False,
00513 basecnt=False) -> bool
00514
00515 Summary
00516 Parse data selection parameters and specific parameters
00517 for the summary mode.
00518
00519
00520 Input Parameters:
00521 field Field indices or source names. Example: '2,3C48'
00522 spw Spectral Window Indices or names. Example: '1,2'
00523 array Array Indices or names. Example: 'VLAA'
00524 feed Feed index or name. Eexample: '1,2' (not supported yet)
00525 scan Scan number. Example: '1,2,3'
00526 antenna Baseline number. Example: '2-3,4-5,132 ????'
00527 uvrange UV-distance range, with a unit. Example: '2.0-3000.0 m'
00528 time Time range, as MJDs or date strings. Example: 'xx.x.x.x.x~yy.y.y.y.y'
00529 correlation Correlations/polarizations. Example: 'RR,LL,RL,LR,XX,YY,XY,YX'
00530 intent Scan intent. Example: '*CAL*, *BAND*'
00531 observation Observation Id. Example: '2~4'
00532 spwchan List the number of flags per spw and per channel. Default: false
00533 spwcorr List the number of flags per spw and per correlation. Default: false
00534 basecnt List the number of flags per baseline. Default: false
00535
00536 --------------------------------------------------------------------------------
00537
00538 """
00539 return _agentflagger.agentflagger_parsesummaryparameters(self, *args, **kwargs)
00540
00541 agentflagger_swigregister = _agentflagger.agentflagger_swigregister
00542 agentflagger_swigregister(agentflagger)
00543
00544
00545
00546