Coverage for /home/warp/casa/atejeda/coverage/build/linux-x86_64/python/2.7/__casac__/agentflagger : 0%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# This file was automatically generated by SWIG (http://www.swig.org). # Version 2.0.4 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead.
from sys import version_info if version_info >= (2,6,0): def swig_import_helper(): from os.path import dirname import imp fp = None try: fp, pathname, description = imp.find_module('_agentflagger', [dirname(__file__)]) except ImportError: import _agentflagger return _agentflagger if fp is not None: try: _mod = imp.load_module('_agentflagger', fp, pathname, description) finally: fp.close() return _mod _agentflagger = swig_import_helper() del swig_import_helper else: import _agentflagger del version_info try: _swig_property = property except NameError: pass # Python < 2.2 doesn't have 'property'. def _swig_setattr_nondynamic(self,class_type,name,value,static=1): if (name == "thisown"): return self.this.own(value) if (name == "this"): if type(value).__name__ == 'SwigPyObject': self.__dict__[name] = value return method = class_type.__swig_setmethods__.get(name,None) if method: return method(self,value) if (not static): self.__dict__[name] = value else: raise AttributeError("You cannot add attributes to %s" % self)
def _swig_setattr(self,class_type,name,value): return _swig_setattr_nondynamic(self,class_type,name,value,0)
def _swig_getattr(self,class_type,name): if (name == "thisown"): return self.this.own() method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError(name)
def _swig_repr(self): try: strthis = "proxy of " + self.this.__repr__() except: strthis = "" return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
try: _object = object _newclass = 1 except AttributeError: class _object : pass _newclass = 0
class agentflagger(_object): """Proxy of C++ casac::agentflagger class""" __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, agentflagger, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, agentflagger, name) __repr__ = _swig_repr def __init__(self): """__init__(self) -> agentflagger""" this = _agentflagger.new_agentflagger() try: self.this.append(this) except: self.this = this __swig_destroy__ = _agentflagger.delete_agentflagger __del__ = lambda self : None; def done(self): """ done(self) -> bool
Summary Destroy the flag tool Example:
af.done()
--------------------------------------------------------------------------------
""" return _agentflagger.agentflagger_done(self)
def open(self, *args, **kwargs): """ open(self, msname = string(""), ntime = 0.0) -> bool
Summary Open the MS or a calibration table and attach it to the tool.
Input Parameters: msname Measurement set or calibration table to be processed. Default: ntime Time interval. If not given, the default will be used. Default: 0.0
Example:
af.open(msname,ntime)
--------------------------------------------------------------------------------
""" return _agentflagger.agentflagger_open(self, *args, **kwargs)
def selectdata(self, *args, **kwargs): """ selectdata(self, config = initialize_record(""), field = string(""), spw = string(""), array = string(""), feed = string(""), scan = string(""), antenna = string(""), uvrange = string(""), timerange = string(""), correlation = string(""), intent = string(""), observation = string("")) -> bool
Summary Select the data based on the given parameters. For unspecified parameters, the full data range is assumed. All data selection parameters follow the MS Selection syntax.
Input Parameters: config The record (dictionary) config may be given or not. If it is not given, and no specific parameter is given either, the whole MS will be selected. The record may contain any data selection parameters supported by MS Selection such as:
field Field indices or source names : example : '2,3C48' spw Spectral Window Indices or names : example : '1,2' array Array Indices or names : example : 'VLAA' feed Feed index or name : example : '1,2' (not supported yet) scan Scan number : example : '1,2,3' antenna Baseline number : example : '2-3,4-5,132 ????' uvrange UV-distance range, with a unit : example : '2.0-3000.0 m' timerange Time range, as MJDs or date strings : example : 'xx.x.x.x.x~yy.y.y.y.y' correlation Correlations/polarizations : example : 'RR,LL,RL,LR,XX,YY,XY,YX,Sol1' intent Scan intent : example : '*CAL*, *BAND*' observation Observation Id : example : '2~4'
Example:
Select the whole MS af.selectdata()
Select a portion of the MS myrecord={} myrecord['scan']='1~3' myrecord['spw']='0:1~10' af.selectdata(myrecord)
Another way to select a portion of the MS af.selectdata(scan='3~5', spw='0')
--------------------------------------------------------------------------------
""" return _agentflagger.agentflagger_selectdata(self, *args, **kwargs)
def parseagentparameters(self, *args, **kwargs): """ parseagentparameters(self, aparams) -> bool
Summary Parse the parameters for the agent (flagging mode).
Description The specific data selection parameters for the agent (flagging mode) are parsed. These parameters are the data selection and mode-specific parameters. See the example below:
Input Parameters: aparams It takes a record (dictionary) with the specific parameters for the flagging mode. The record may contain any data selection parameters supported by MS Selection, as well as mode-specific parameters such as:
(1) array,feed,scan,field,spw,intent,correlation,antenna,uvrange,observation (2) mode (which can be: manual,clip,quack,shadow,elevation,tfcrop,extendflags,unflag or summary) For flagging mode=clip, the parameters are: expression, datacolumns, clipminmax, etc. See the documentation of the task tflagger for all the available parameters for each mode.
(3) apply: default is true (true for flagging and false for unflagging) Example:
myrecord={} myrecord['mode']='clip' myrecord['scan']='1~3' myrecord['clipminmax']=[0.02,0.3] myrecord['apply']=True af.parseagentparameters(myrecord)
Example:
myrecord={} myrecord['mode']='clip' myrecord['scan']='1~3' myrecord['clipminmax']=[0.02,0.3] myrecord['apply']=True af.parseagentparameters(myrecord)
--------------------------------------------------------------------------------
""" return _agentflagger.agentflagger_parseagentparameters(self, *args, **kwargs)
def init(self): """ init(self) -> bool
Summary Initialize the agents
Description This method will initialize the agents and create a list of agents with their specific parameters. It takes no parameters.
Example:
af.init()
--------------------------------------------------------------------------------
""" return _agentflagger.agentflagger_init(self)
def run(self, writeflags = True, sequential = True): """ run(self, writeflags = True, sequential = True) -> record
Summary Execute a list of flagging agents
Description
Execute a list of flagging agents and write or not to the MS/cal table. The parameter writeflags controls whether or not to write to the MS.
Input Parameters: writeflags Write flags to MS true sequential Run the task in sequential or in parallel. true
Example:
af.run()
--------------------------------------------------------------------------------
""" return _agentflagger.agentflagger_run(self, writeflags, sequential)
def getflagversionlist(self, printflags = True): """ getflagversionlist(self, printflags = True) -> std::vector<(std::string)>
Summary Print out a list of saved flag_versions.
Description
Print out the list of flag versions in the MS, unless the parameter printflags=False. The list of names is returned.
Input Parameters: printflags Print flagversions in logger? true
--------------------------------------------------------------------------------
""" return _agentflagger.agentflagger_getflagversionlist(self, printflags)
def printflagselection(self): """ printflagselection(self) -> bool
Summary Print out a list of current flag selections.
Description
Print out a list of current flag selections.
--------------------------------------------------------------------------------
""" return _agentflagger.agentflagger_printflagselection(self)
def saveflagversion(self, *args, **kwargs): """ saveflagversion(self, versionname = string(""), comment = string(""), merge = string("")) -> bool
Summary Save current flags with a version name.
Description
Input Parameters: versionname Version name comment Comment for this flag table merge merge type
--------------------------------------------------------------------------------
""" return _agentflagger.agentflagger_saveflagversion(self, *args, **kwargs)
def restoreflagversion(self, *args, **kwargs): """ restoreflagversion(self, versionname = std::vector< string >(1, ""), merge = string("")) -> bool
Summary Restore flags from a saved flag_version. n versionname : name of flag version to restore to main table n merge : Type of operation to perform during restoration. n merge = replace : replaces the main table flags. n merge = and : logical AND with main table flags n merge = or : logical OR with main table flags n Default : replace. n
Description
Input Parameters: versionname Version name merge merge type
--------------------------------------------------------------------------------
""" return _agentflagger.agentflagger_restoreflagversion(self, *args, **kwargs)
def deleteflagversion(self, *args, **kwargs): """ deleteflagversion(self, versionname = std::vector< string >(1, "")) -> bool
Summary Delete a saved flag_version.
Description
Input Parameters: versionname Version name
--------------------------------------------------------------------------------
""" return _agentflagger.agentflagger_deleteflagversion(self, *args, **kwargs)
def parsemanualparameters(self, *args, **kwargs): """ parsemanualparameters(self, field = string(""), spw = string(""), array = string(""), feed = string(""), scan = string(""), antenna = string(""), uvrange = string(""), time = string(""), correlation = string(""), intent = string(""), observation = string(""), autocorr = False, apply = True) -> bool
Summary Parse data selection parameters and specific parameters for the manual mode.
Input Parameters: field Field indices or source names. Example: '2,3C48' spw Spectral Window Indices or names. Example: '1,2' array Array Indices or names. Example: 'VLAA' feed Feed index or name. Eexample: '1,2' (not supported yet) scan Scan number. Example: '1,2,3' antenna Baseline number. Example: '2-3,4-5,132 ????' uvrange UV-distance range, with a unit. Example: '2.0-3000.0 m' time Time range, as MJDs or date strings. Example: 'xx.x.x.x.x~yy.y.y.y.y' correlation Correlations/polarizations. Example: 'RR,LL,RL,LR,XX,YY,XY,YX' intent Scan intent. Example: '*CAL*, *BAND*' observation Observation Id. Example: '2~4' autocorr Parameter to flag only auto-correlations. Default: false apply Parameter to flag or unflag the data. Default: true
Example:
af.parsemanualparameters(autocorr=True)
--------------------------------------------------------------------------------
""" return _agentflagger.agentflagger_parsemanualparameters(self, *args, **kwargs)
def parseclipparameters(self, *args, **kwargs): """ parseclipparameters(self, field = string(""), spw = string(""), array = string(""), feed = string(""), scan = string(""), antenna = string(""), uvrange = string(""), time = string(""), correlation = string(""), intent = string(""), observation = string(""), datacolumn = string("DATA"), clipminmax = std::vector< double >(), clipoutside = True, channelavg = False, clipzeros = False, apply = True) -> bool
Summary Parse data selection parameters and specific parameters for the clip mode.
Input Parameters: field Field indices or source names. Example: '2,3C48' spw Spectral Window Indices or names. Example: '1,2' array Array Indices or names. Example: 'VLAA' feed Feed index or name. Eexample: '1,2' (not supported yet) scan Scan number. Example: '1,2,3' antenna Baseline number. Example: '2-3,4-5,132 ????' uvrange UV-distance range, with a unit. Example: '2.0-3000.0 m' time Time range, as MJDs or date strings. Example: 'xx.x.x.x.x~yy.y.y.y.y' correlation Correlations/polarizations. Example: 'RR,LL,RL,LR,XX,YY,XY,YX' intent Scan intent. Example: '*CAL*, *BAND*' observation Observation Id. Example: '2~4' datacolumn Data column to use for clipping. Supported columns for cal tables are FPARAM,CPARAM,SNR. Example: 'DATA'. Default: DATA clipminmax Range to use for clipping. Example: [100.0,200.0] clipoutside Clip points outside this range? [True/False]. Default: true channelavg Average data over channels before clipping? [True/False]. Default: false clipzeros Clip zero-value data. [True/False]. Default: false apply Parameter to flag or unflag data. Default: true
Example:
The correlation parameter can be used with an operator for the clip mode. The operator should be written only once and it will affect all the polarizations given in the string. See the example below:
af.parseclipparameters(clipzeros=True, clipminmax=[0.,4.], correlation='ABS_XX,XY')
or for a calibration table: af.parseclipparameters(clipzeros=True, clipminmax=[0.,4.], correlation='Sol1')
--------------------------------------------------------------------------------
""" return _agentflagger.agentflagger_parseclipparameters(self, *args, **kwargs)
def parsequackparameters(self, *args, **kwargs): """ parsequackparameters(self, field = string(""), spw = string(""), array = string(""), feed = string(""), scan = string(""), antenna = string(""), uvrange = string(""), time = string(""), correlation = string(""), intent = string(""), observation = string(""), quackmode = string("beg"), quackinterval = 0.0, quackincrement = False, apply = True) -> bool
Summary Parse data selection parameters and specific parameters for the quack mode.
Input Parameters: field Field indices or source names. Example: '2,3C48' spw Spectral Window Indices or names. Example: '1,2' array Array Indices or names. Example: 'VLAA' feed Feed index or name. Eexample: '1,2' (not supported yet) scan Scan number. Example: '1,2,3' antenna Baseline number. Example: '2-3,4-5,132 ????' uvrange UV-distance range, with a unit. Example: '2.0-3000.0 m' time Time range, as MJDs or date strings. Example: 'xx.x.x.x.x~yy.y.y.y.y' correlation Correlations/polarizations. Example: 'RR,LL,RL,LR,XX,YY,XY,YX' intent Scan intent. Example: '*CAL*, *BAND*' observation Observation Id. Example: '2~4' quackmode Quack mode. Default: beg quackinterval Quack length in seconds. Default: 0.0 quackincrement Flag incrementally in time. Default: false apply Parameter to flag or unflag the data. Default: true
Example:
af.parsequackparameters(scan='1~3', quackmode='beg', quackinterval=1)
--------------------------------------------------------------------------------
""" return _agentflagger.agentflagger_parsequackparameters(self, *args, **kwargs)
def parseelevationparameters(self, *args, **kwargs): """ parseelevationparameters(self, field = string(""), spw = string(""), array = string(""), feed = string(""), scan = string(""), antenna = string(""), uvrange = string(""), time = string(""), correlation = string(""), intent = string(""), observation = string(""), lowerlimit = 0.0, upperlimit = 90.0, apply = True) -> bool
Summary Parse data selection parameters and specific parameters for the elevation mode.
Input Parameters: field Field indices or source names. Example: '2,3C48' spw Spectral Window Indices or names. Example: '1,2' array Array Indices or names. Example: 'VLAA' feed Feed index or name. Eexample: '1,2' (not supported yet) scan Scan number. Example: '1,2,3' antenna Baseline number. Example: '2-3,4-5,132 ????' uvrange UV-distance range, with a unit. Example: '2.0-3000.0 m' time Time range, as MJDs or date strings. Example: 'xx.x.x.x.x~yy.y.y.y.y' correlation Correlations/polarizations. Example: 'RR,LL,RL,LR,XX,YY,XY,YX' intent Scan intent. Example: '*CAL*, *BAND*' observation Observation Id. Example: '2~4' lowerlimit The limiting elevation in degrees. Data obtained at lower antenna elevations will get flagged. Default: 0.0 upperlimit The limiting elevation in degrees. Data obtained at higher antenna elevations will get flagged. Default: 90.0 apply Parameter to flag or unflag the data. Default: true
Example:
To unflag, set the apply parameter. af.parseelevationparameters(upperlimit=50.,lowerlimit=10.0, apply=False)
--------------------------------------------------------------------------------
""" return _agentflagger.agentflagger_parseelevationparameters(self, *args, **kwargs)
def parsetfcropparameters(self, *args, **kwargs): """ parsetfcropparameters(self, field = string(""), spw = string(""), array = string(""), feed = string(""), scan = string(""), antenna = string(""), uvrange = string(""), time = string(""), correlation = string(""), intent = string(""), observation = string(""), ntime = 0.0, combinescans = False, datacolumn = string("DATA"), timecutoff = 4.0, freqcutoff = 3.0, timefit = string("line"), freqfit = string("poly"), maxnpieces = 7, flagdimension = string("freqtime"), usewindowstats = string("none"), halfwin = 1, extendflags = True, apply = True) -> bool
Summary Parse data selection parameters and specific parameters for the time and frequency mode.
Input Parameters: field Field indices or source names. Example: '2,3C48' spw Spectral Window Indices or names. Example: '1,2' array Array Indices or names. Example: 'VLAA' feed Feed index or name. Eexample: '1,2' (not supported yet) scan Scan number. Example: '1,2,3' antenna Baseline number. Example: '2-3,4-5,132 ????' uvrange UV-distance range, with a unit. Example: '2.0-3000.0 m' time Time range, as MJDs or date strings. Example: 'xx.x.x.x.x~yy.y.y.y.y' correlation Correlations/polarizations. Example: 'RR,LL,RL,LR,XX,YY,XY,YX' intent Scan intent. Example: '*CAL*, *BAND*' observation Observation Id. Example: '2~4' ntime Time-range to use for each chunk (in seconds or minutes). Default: 0.0 combinescans Accumulate data across scans depending on the value of ntime. Default: false datacolumn Data column to use for clipping. Example: 'DATA'. Default: DATA timecutoff Flagging thresholds in units of deviation from the fit. Default: 4.0 freqcutoff Flagging thresholds in units of deviation from the fit. Default: 3.0 timefit Fitting function for the time direction (poly/line). Default: line freqfit Fitting function for the frequency direction (poly/line). Default: poly maxnpieces Number of pieces in the polynomial-fits (for 'freqfit' or 'timefit' = 'poly'). Default: 7 flagdimension Dimensions along which to calculate fits (freq/time/freqtime/timefreq). Default: freqtime usewindowstats Calculate additional flags using sliding window statistics (none,sum,std,both). Default: none halfwin Half-width of sliding window to use with 'usewindowstats' (1,2,3). Default: 1 extendflags Extend the flags in time, frequency and correlations. Default: true apply Parameter to flag or unflag the data. Default: true
Example:
The correlation parameter can be used with an operator for the tfcrop mode. The operator should be written only once and it will affect all the polarizations given in the string. Note that if ntime='scan' and combinescans=True, all the scans will be loaded at once, thus requesting a lot of memory depending on the available spws. The parameter combinescans should be set to True only when ntime is specified as a time-interval (not 'scan'). By default, the flags will be extended in time, if more than 50\% of the timeranges are flagged, 80\% of the channels are flagged and it will extend to other polarizations too. This is similar to running the extend mode after running tfcrop on the MS.
af.parsetfcropparameters(spw='9', ntime=10.0, combinescans=True, correlation='ABS_XX,XY', extendflags=True)
--------------------------------------------------------------------------------
""" return _agentflagger.agentflagger_parsetfcropparameters(self, *args, **kwargs)
def parseextendparameters(self, *args, **kwargs): """ parseextendparameters(self, field = string(""), spw = string(""), array = string(""), feed = string(""), scan = string(""), antenna = string(""), uvrange = string(""), time = string(""), correlation = string(""), intent = string(""), observation = string(""), ntime = 0.0, combinescans = False, extendpols = True, growtime = 50.0, growfreq = 50.0, growaround = False, flagneartime = False, flagnearfreq = False, apply = True) -> bool
Summary Parse data selection parameters and specific parameters for the extend mode.
Input Parameters: field Field indices or source names. Example: '2,3C48' spw Spectral Window Indices or names. Example: '1,2' array Array Indices or names. Example: 'VLAA' feed Feed index or name. Eexample: '1,2' (not supported yet) scan Scan number. Example: '1,2,3' antenna Baseline number. Example: '2-3,4-5,132 ????' uvrange UV-distance range, with a unit. Example: '2.0-3000.0 m' time Time range, as MJDs or date strings. Example: 'xx.x.x.x.x~yy.y.y.y.y' correlation Correlations/polarizations. Example: 'RR,LL,RL,LR,XX,YY,XY,YX' intent Scan intent. Example: '*CAL*, *BAND*' observation Observation Id. Example: '2~4' ntime Time-range to use for each chunk (in seconds or minutes). Default: 0.0 combinescans Accumulate data across scans.. Default: false extendpols If any correlation is flagged, flag all correlations. Default: true growtime Flag all 'ntime' integrations if more than X\% of the timerange is flagged (0-100). Default: 50.0 growfreq Flag all selected channels if more than X\% of the frequency range is flagged(0-100). Default: 50.0 growaround Flag data based on surrounding flags. Default: false flagneartime Flag one timestep before and after a flagged one. Default: false flagnearfreq Flag one channel before and after a flagged one. Default: false apply Parameter to flag or unflag the data. Default: true
Example:
af.parseextendparameters(extendpols=True)
--------------------------------------------------------------------------------
""" return _agentflagger.agentflagger_parseextendparameters(self, *args, **kwargs)
def parsesummaryparameters(self, *args, **kwargs): """ parsesummaryparameters(self, field = string(""), spw = string(""), array = string(""), feed = string(""), scan = string(""), antenna = string(""), uvrange = string(""), time = string(""), correlation = string(""), intent = string(""), observation = string(""), spwchan = False, spwcorr = False, basecnt = False, name = string("")) -> bool
Summary Parse data selection parameters and specific parameters for the summary mode.
Input Parameters: field Field indices or source names. Example: '2,3C48' spw Spectral Window Indices or names. Example: '1,2' array Array Indices or names. Example: 'VLAA' feed Feed index or name. Eexample: '1,2' (not supported yet) scan Scan number. Example: '1,2,3' antenna Baseline number. Example: '2-3,4-5,132 ????' uvrange UV-distance range, with a unit. Example: '2.0-3000.0 m' time Time range, as MJDs or date strings. Example: 'xx.x.x.x.x~yy.y.y.y.y' correlation Correlations/polarizations. Example: 'RR,LL,RL,LR,XX,YY,XY,YX' intent Scan intent. Example: '*CAL*, *BAND*' observation Observation Id. Example: '2~4' spwchan List the number of flags per spw and per channel. Default: false spwcorr List the number of flags per spw and per correlation. Default: false basecnt List the number of flags per baseline. Default: false name Name of this summary report. Default: summary
Example:
af.parsesummaryparameters(spwchan=True, basecnt=True)
--------------------------------------------------------------------------------
""" return _agentflagger.agentflagger_parsesummaryparameters(self, *args, **kwargs)
agentflagger_swigregister = _agentflagger.agentflagger_swigregister agentflagger_swigregister(agentflagger)
# This file is compatible with both classic and new-style classes.
|