##################### generated by xml-casa (v2) from hifa_flagdata.xml #############
##################### 3a2d143eac81bfcdab5a9bc42506d4d9 ##############################
from __future__ import absolute_import
import numpy
from casatools.typecheck import CasaValidator as _val_ctor
_pc = _val_ctor( )
from casatools.coercetype import coerce as _coerce
from .private.task_hifa_flagdata import hifa_flagdata as _hifa_flagdata_t
from casatasks.private.task_logging import start_log as _start_log
from casatasks.private.task_logging import end_log as _end_log
class _hifa_flagdata:
"""
hifa_flagdata ---- Do meta data based flagging of a list of MeasurementSets.
The hifa_flagdata data performs basic flagging operations on a list of
measurements including:
o applying online flags
o applying a flagging template
o autocorrelation data flagging
o shadowed antenna data flagging
o scan-based flagging by intent or scan number
o edge channel flagging, as needed
About the spectral window edge channel flagging:
o For TDM spectral windows, a number of edge channels are always flagged,
according to the fracspw and fracspwfps parameters (the latter operates only
on spectral windows with 62, 124, or 248 channels). With the default setting
of fracspw, the number of channels flagged on each edge is 2, 4, or 8 for 64,
128, or 256-channel spectral windows, respectively.
o For most FDM spectral windows, no edge flagging is done. The only exceptions
are ACA spectral windows that encroach too close to the baseband edge.
Channels that lie closer to the baseband edge than the following values are
flagged: 62.5, 40, 20, 10, and 5 MHz for spectral windows with bandwidths of
1000, 500, 250, 125, and 62.5 MHz, respectively. A warning is generated in
the weblog if flagging occurs due to proximity to the baseband edge.
By definition, 2000 MHz spectral windows always encroach the baseband edge on
both sides of the spectral window, and thus are always flagged on both sides
in order to achieve 1875 MHz bandwidth (in effect, they are flagged by
62.5 MHz on each side), and thus no warning is generated.
Output
results -- If pipeline mode is 'getinputs' then None is returned. Otherwise
the results object for the pipeline task is returned.
--------- parameter descriptions ---------------------------------------------
vis The list of input MeasurementSets. Defaults to the list of
MeasurementSets defined in the pipeline context.
autocorr Flag autocorrelation data.
shadow Flag shadowed antennas.
tolerance Amount of antenna shadowing tolerated, in meters. A positive number
allows antennas to overlap in projection. A negative number forces antennas
apart in projection. Zero implies a distance of radius_1+radius_2 between
antenna centers.
scan Flag a list of specified scans.
scannumber A string containing a comma delimited list of scans to be
flagged.
example: scannumber='3,5,6'
intents A string containing a comma delimited list of intents against
which the scans to be flagged are matched.
example: intents='*BANDPASS*'
edgespw Flag the edge spectral window channels.
fracspw Fraction of channels to flag at both edges of TDM spectral windows.
fracspwfps Fraction of channels to flag at both edges of ACA TDM
spectral windows that were created with the earlier (original)
implementation of the frequency profile synthesis (FPS) algorithm.
online Apply the online flags.
fileonline File containing the online flags. These are computed by the
h_init or hif_importdata data tasks. If the online flags files
are undefined a name of the form 'msname.flagonline.txt' is assumed.
template Apply flagging templates
filetemplate The name of a text file that contains the flagging template
for RFI, birdies, telluric lines, etc. If the template flags files
is undefined a name of the form 'msname.flagtemplate.txt' is assumed.
hm_tbuff The heuristic for computing the default time interval padding
parameter. The options are 'halfint' and 'manual'. In 'halfint' mode tbuff
is set to half the maximum of the median integration time of the science
and calibrator target observations. The value of 0.048 seconds is
subtracted from the lower time limit to accommodate the behavior of the
ALMA Control system.
tbuff The time in seconds used to pad flagging command time intervals if
hm_tbuff='manual'. The default in manual mode is no flagging.
qa0 QA0 flags.
qa2 QA2 flags.
pipelinemode The pipeline operating mode. In 'automatic' mode the pipeline
determines the values of all context defined pipeline inputs automatically.
In interactive mode the user can set the pipeline context defined parameters
manually. In 'getinputs' mode the user can check the settings of all
pipeline parameters without running the task.
flagbackup Back up any pre-existing flags.
dryrun Run the commands (True) or generate the commands to be run but do not
execute (False).
acceptresults Add the results of the task to the pipeline context (True) or
reject them (False).
--------- examples -----------------------------------------------------------
1. Do basic flagging on a MeasurementSet:
hifa_flagdata()
2. Do basic flagging on a MeasurementSet flagging additional scans selected
by number as well:
hifa_flagdata(scannumber='13,18')
"""
_info_group_ = """pipeline"""
_info_desc_ = """Do meta data based flagging of a list of MeasurementSets."""
def __call__( self, vis=[ ], autocorr=True, shadow=True, tolerance=float(0.0), scan=True, scannumber='', intents='POINTING,FOCUS,ATMOSPHERE,SIDEBAND', edgespw=True, fracspw=float(0.03125), fracspwfps=float(0.048387), online=True, fileonline='', template=True, filetemplate=[ ], hm_tbuff='halfint', tbuff=[ ], qa0=True, qa2=True, pipelinemode='automatic', flagbackup=True, dryrun=False, acceptresults=True ):
schema = {'vis': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'autocorr': {'type': 'cBool'}, 'shadow': {'type': 'cBool'}, 'tolerance': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'scan': {'type': 'cBool'}, 'scannumber': {'type': 'cStr', 'coerce': _coerce.to_str}, 'intents': {'type': 'cStr', 'coerce': _coerce.to_str}, 'edgespw': {'type': 'cBool'}, 'fracspw': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'fracspwfps': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'online': {'type': 'cBool'}, 'fileonline': {'type': 'cStr', 'coerce': _coerce.to_str}, 'template': {'type': 'cBool'}, 'filetemplate': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'hm_tbuff': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'halfint', 'manual' ]}, 'tbuff': {'anyof': [{'type': 'cFloat', 'coerce': _coerce.to_float}, {'type': 'cFloatVec', 'coerce': [_coerce.to_list,_coerce.to_floatvec]}]}, 'qa0': {'type': 'cBool'}, 'qa2': {'type': 'cBool'}, 'pipelinemode': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'automatic', 'interactive', 'getinputs' ]}, 'flagbackup': {'type': 'cBool'}, 'dryrun': {'type': 'cBool'}, 'acceptresults': {'type': 'cBool'}}
doc = {'vis': vis, 'autocorr': autocorr, 'shadow': shadow, 'tolerance': tolerance, 'scan': scan, 'scannumber': scannumber, 'intents': intents, 'edgespw': edgespw, 'fracspw': fracspw, 'fracspwfps': fracspwfps, 'online': online, 'fileonline': fileonline, 'template': template, 'filetemplate': filetemplate, 'hm_tbuff': hm_tbuff, 'tbuff': tbuff, 'qa0': qa0, 'qa2': qa2, 'pipelinemode': pipelinemode, 'flagbackup': flagbackup, 'dryrun': dryrun, 'acceptresults': acceptresults}
assert _pc.validate(doc,schema), str(_pc.errors)
_logging_state_ = _start_log( 'hifa_flagdata', [ 'vis=' + repr(_pc.document['vis']), 'autocorr=' + repr(_pc.document['autocorr']), 'shadow=' + repr(_pc.document['shadow']), 'tolerance=' + repr(_pc.document['tolerance']), 'scan=' + repr(_pc.document['scan']), 'scannumber=' + repr(_pc.document['scannumber']), 'intents=' + repr(_pc.document['intents']), 'edgespw=' + repr(_pc.document['edgespw']), 'fracspw=' + repr(_pc.document['fracspw']), 'fracspwfps=' + repr(_pc.document['fracspwfps']), 'online=' + repr(_pc.document['online']), 'fileonline=' + repr(_pc.document['fileonline']), 'template=' + repr(_pc.document['template']), 'filetemplate=' + repr(_pc.document['filetemplate']), 'hm_tbuff=' + repr(_pc.document['hm_tbuff']), 'tbuff=' + repr(_pc.document['tbuff']), 'qa0=' + repr(_pc.document['qa0']), 'qa2=' + repr(_pc.document['qa2']), 'pipelinemode=' + repr(_pc.document['pipelinemode']), 'flagbackup=' + repr(_pc.document['flagbackup']), 'dryrun=' + repr(_pc.document['dryrun']), 'acceptresults=' + repr(_pc.document['acceptresults']) ] )
return _end_log( _logging_state_, 'hifa_flagdata', _hifa_flagdata_t( _pc.document['vis'], _pc.document['autocorr'], _pc.document['shadow'], _pc.document['tolerance'], _pc.document['scan'], _pc.document['scannumber'], _pc.document['intents'], _pc.document['edgespw'], _pc.document['fracspw'], _pc.document['fracspwfps'], _pc.document['online'], _pc.document['fileonline'], _pc.document['template'], _pc.document['filetemplate'], _pc.document['hm_tbuff'], _pc.document['tbuff'], _pc.document['qa0'], _pc.document['qa2'], _pc.document['pipelinemode'], _pc.document['flagbackup'], _pc.document['dryrun'], _pc.document['acceptresults'] ) )
hifa_flagdata = _hifa_flagdata( )