Source code for pipeline.hsd.cli.hsd_flagdata

##################### generated by xml-casa (v2) from hsd_flagdata.xml ##############
##################### d5d4042975e6c648a73bc29b7547f0e6 ##############################
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_hsd_flagdata import hsd_flagdata as _hsd_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 _hsd_flagdata:
    """
    hsd_flagdata ---- Do basic flagging of a list of MeasurementSets

    
    The hsd_flagdata data performs basic flagging operations on a list of
    MeasurementSets including:
    
    o applying online flags
    o applying a flagging template
    o shadowed antenna data flagging
    o scan-based flagging by intent or scan number
    o edge channel flagging
    
    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.
    scan             Flag a list of specified scans.
    scannumber       A string containing a comma delimited list of scans to be
                     flagged.
    intents          A string containing a comma delimited list of intents against
                     which the scans to be flagged are matched.
                     
                     example: '*BANDPASS*'
    edgespw          Flag the edge spectral window channels.
    fracspw          Fraction of the baseline correlator TDM edge channels to be flagged.
    fracspwfps       Fraction of the ACS correlator TDM edge channels to be flagged.
    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 a flagging template.
    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.
    pointing         Apply a flagging template for pointing flag.
    filepointing     The name of a text file that contains the flagging template
                     for pointing flag. If the template flags files is undefined a name of
                     the form 'msname.flagpointing.txt' is assumed.
    incompleteraster Apply commands to flag incomplete raster sequence.
                     If this is False, relevant commands in filepointing are
                     simply commented out.
    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.
    tbuff            The time in seconds used to pad flagging command time intervals if
                     hm_tbuff='manual'.
    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 before applying new ones.
    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
    
    hsd_flagdata()
    
    2. Do basic flagging on a MeasurementSet flagging additional scans selected
    by number as well.
    
    hsd_flagdata(scannumber='13,18')


    """

    _info_group_ = """pipeline"""
    _info_desc_ = """Do basic flagging of a list of MeasurementSets"""

    def __call__( self, vis=[  ], autocorr=False, shadow=True, scan=True, scannumber='', intents='POINTING,FOCUS,ATMOSPHERE,SIDEBAND,CHECK', edgespw=True, fracspw='1.875GHz', fracspwfps=float(0.048387), online=True, fileonline='', template=True, filetemplate=[  ], pointing=True, filepointing=[  ], incompleteraster=True, hm_tbuff='halfint', tbuff=float(0.0), qa0=True, qa2=True, pipelinemode='automatic', flagbackup=False, dryrun=False, acceptresults=True ):
        schema = {'vis': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'autocorr': {'type': 'cBool'}, 'shadow': {'type': 'cBool'}, 'scan': {'type': 'cBool'}, 'scannumber': {'type': 'cStr', 'coerce': _coerce.to_str}, 'intents': {'type': 'cStr', 'coerce': _coerce.to_str}, 'edgespw': {'type': 'cBool'}, 'fracspw': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, '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]}, 'pointing': {'type': 'cBool'}, 'filepointing': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'incompleteraster': {'type': 'cBool'}, '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, 'scan': scan, 'scannumber': scannumber, 'intents': intents, 'edgespw': edgespw, 'fracspw': fracspw, 'fracspwfps': fracspwfps, 'online': online, 'fileonline': fileonline, 'template': template, 'filetemplate': filetemplate, 'pointing': pointing, 'filepointing': filepointing, 'incompleteraster': incompleteraster, '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( 'hsd_flagdata', [ 'vis=' + repr(_pc.document['vis']), 'autocorr=' + repr(_pc.document['autocorr']), 'shadow=' + repr(_pc.document['shadow']), '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']), 'pointing=' + repr(_pc.document['pointing']), 'filepointing=' + repr(_pc.document['filepointing']), 'incompleteraster=' + repr(_pc.document['incompleteraster']), '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_, 'hsd_flagdata', _hsd_flagdata_t( _pc.document['vis'], _pc.document['autocorr'], _pc.document['shadow'], _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['pointing'], _pc.document['filepointing'], _pc.document['incompleteraster'], _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'] ) )

hsd_flagdata = _hsd_flagdata( )