Source code for pipeline.hif.cli.hif_refant

##################### generated by xml-casa (v2) from hif_refant.xml ################
##################### 0bc4ca0c4b21396ae5f3ac3475bf1854 ##############################
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_hif_refant import hif_refant as _hif_refant_t
from casatasks.private.task_logging import start_log as _start_log
from casatasks.private.task_logging import end_log as _end_log

class _hif_refant:
    """
    hif_refant ---- Select the best reference antennas

    
    The hif_refant task selects a list of reference antennas and stores them
    in the pipeline context in priority order.
    
    The priority order is determined by a weighted combination of scores derived
    by the antenna selection heuristics. In manual mode the reference antennas
    can be set by hand.
    
    Output:
    
    results -- If pipeline mode is 'getinputs' then None is returned. Otherwise
    the results object for the pipeline task is returned.
    
    Issues

    --------- parameter descriptions ---------------------------------------------

    vis           The list of input MeasurementSets. Defaults to the list of MeasurementSets
                  in the pipeline context. Not available when pipelinemode='automatic'.
                  example: ['M31.ms']
    field         The comma delimited list of field names or field ids for which flagging
                  scores are computed if hm_refant='automatic' and  flagging = True
                  Not available when pipelinemode='automatic'.
                  example: '' (Default to fields with the specified intents), '3C279', '3C279,M82'
    spw           A string containing the comma delimited list of spectral window ids for
                  which flagging scores are computed if hm_refant='automatic' and  flagging = True.
                  Not available when pipelinemode='automatic'.
                  example: '' (all spws observed with the specified intents), '11,13,15,17'
    intent        A string containing a comma delimited list of intents against
                  which the selected fields are matched. Defaults to all supported
                  intents. Not available when pipelinemode='automatic'.
                  example: 'BANDPASS', 'AMPLITUDE,BANDPASS,PHASE,POLARIZATION'
    hm_refant     The heuristics method or mode for selection the reference
                  antenna. The options are 'manual' and 'automatic. In manual
                  mode a user supplied reference antenna refant is supplied.
                  In 'automatic' mode the antennas are selected automatically.
    refant        The user supplied reference antenna for hm_refant='manual'. If
                  no antenna list is supplied an empty list is returned.
                  example: 'DV05'
    geometry      Score antenna by proximity to the center of the array. This
                  option is quick as only the ANTENNA table must be read.
                  Parameter is available when hm_refant='automatic'.
    flagging      Score antennas by percentage of unflagged data.  This option
                  requires computing flagging statistics.
                  Parameter is available when hm_refant='automatic'.
    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.
    dryrun        Run the task (False) or display the command (True)
                  Available when pipelinemode='interactive'.
    acceptresults Add the results of the task to the pipeline context (True) or
                  reject them (False). Available when pipelinemode='interactive'.
    refantignore  string list to be ignored as reference antennas.
                  example:  refantignore='ea02,ea03'

    --------- examples -----------------------------------------------------------

    
    
    1. Compute the references antennas to be used for bandpass and gain calibration.
    
    hif_refant()


    """

    _info_group_ = """pipeline"""
    _info_desc_ = """Select the best reference antennas"""

    def __call__( self, vis=[  ], field='', spw='', intent='AMPLITUDE,BANDPASS,PHASE,POLARIZATION', hm_refant='automatic', refant='', geometry=True, flagging=True, pipelinemode='automatic', dryrun=False, acceptresults=True, refantignore='' ):
        schema = {'vis': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'field': {'type': 'cStr', 'coerce': _coerce.to_str}, 'spw': {'type': 'cStr', 'coerce': _coerce.to_str}, 'intent': {'type': 'cStr', 'coerce': _coerce.to_str}, 'hm_refant': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'automatic', 'manual' ]}, 'refant': {'type': 'cStr', 'coerce': _coerce.to_str}, 'geometry': {'type': 'cBool'}, 'flagging': {'type': 'cBool'}, 'pipelinemode': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'automatic', 'interactive', 'getinputs' ]}, 'dryrun': {'type': 'cBool'}, 'acceptresults': {'type': 'cBool'}, 'refantignore': {'type': 'cStr', 'coerce': _coerce.to_str}}
        doc = {'vis': vis, 'field': field, 'spw': spw, 'intent': intent, 'hm_refant': hm_refant, 'refant': refant, 'geometry': geometry, 'flagging': flagging, 'pipelinemode': pipelinemode, 'dryrun': dryrun, 'acceptresults': acceptresults, 'refantignore': refantignore}
        assert _pc.validate(doc,schema), str(_pc.errors)
        _logging_state_ = _start_log( 'hif_refant', [ 'vis=' + repr(_pc.document['vis']), 'field=' + repr(_pc.document['field']), 'spw=' + repr(_pc.document['spw']), 'intent=' + repr(_pc.document['intent']), 'hm_refant=' + repr(_pc.document['hm_refant']), 'refant=' + repr(_pc.document['refant']), 'geometry=' + repr(_pc.document['geometry']), 'flagging=' + repr(_pc.document['flagging']), 'pipelinemode=' + repr(_pc.document['pipelinemode']), 'dryrun=' + repr(_pc.document['dryrun']), 'acceptresults=' + repr(_pc.document['acceptresults']), 'refantignore=' + repr(_pc.document['refantignore']) ] )
        return _end_log( _logging_state_, 'hif_refant', _hif_refant_t( _pc.document['vis'], _pc.document['field'], _pc.document['spw'], _pc.document['intent'], _pc.document['hm_refant'], _pc.document['refant'], _pc.document['geometry'], _pc.document['flagging'], _pc.document['pipelinemode'], _pc.document['dryrun'], _pc.document['acceptresults'], _pc.document['refantignore'] ) )

hif_refant = _hif_refant( )