Source code for pipeline.hif.cli.hif_bandpass

##################### generated by xml-casa (v2) from hif_bandpass.xml ##############
##################### 28622e1d10930baef7af7d8021110755 ##############################
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_bandpass import hif_bandpass as _hif_bandpass_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_bandpass:
    """
    hif_bandpass ---- Compute bandpass calibration solutions

    
    Compute amplitude and phase as a function of frequency for each spectral
    window in each MeasurementSet.
    
    Previous calibration can be applied on the fly.
    
    
    Description
    
    hif_bandpass computes a bandpass solution for every specified science
    spectral window. By default a 'phaseup' pre-calibration is performed
    and applied on the fly to the data, before the bandpass is computed.
    
    The hif_refant task may be used to precompute a prioritized list of
    reference antennas.
    
    
    Issues
    
    There is currently some discussion about whether or not to do an 'ampup'
    operations at the same time as the 'phaseup'. This is not required for the
    bandpass computation but the amplitude information may provide a useful quality
    assessment measure.
    
    The specified minsnr parameter is currently applied to the bandpass
    solution computation but not the 'phaseup' computation. Some noisy
    solutions in the phaseup may not be properly rejected.
    
    
    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 specified in the h_init or hif_importdata task.
                  '': use all MeasurementSets in the context
                  
                  Examples: 'ngc5921.ms', ['ngc5921a.ms', ngc5921b.ms', 'ngc5921c.ms']
    caltable      The list of output calibration tables. Defaults to the
                  standard pipeline naming convention.
                  
                  Example: caltable=['M82.gcal', 'M82B.gcal']
    field         The list of field names or field ids for which bandpasses are
                  computed. Defaults to all fields.
                  
                  Examples: field='3C279', field='3C279, M82'
    intent        A string containing a comma delimited list of intents against
                  which the selected fields are matched.  Defaults to all data
                  with bandpass intent.
                  
                  Example: intent='*PHASE*'
    spw           The list of spectral windows and channels for which bandpasses
                  are computed. Defaults to all science spectral windows.
                  
                  Example: spw='11,13,15,17'
    antenna       Set of data selection antenna IDs
    phaseup       Do a phaseup on the data before computing the bandpass
                  solution.
    phaseupsolint The phase correction solution interval in CASA syntax. 
                  Used when phaseup is True.
                  
                  Example: phaseupsolint=300
    phaseupbw     Bandwidth to be used for phaseup. Defaults to 500MHz.
                  Used when phaseup is True.
                  
                  Examples: phaseupbw='' to use entire bandpass
                            phaseupbw='500MHz' to use central 500MHz
    solint        Time and channel solution intervals in CASA syntax.
                  
                  Examples: solint='inf,10ch', 'inf'
    combine       Data axes to combine for solving. Axes are '', 'scan', 'spw',
                  'field' or any comma-separated combination.
                  
                  Example: combine='scan,field'
    refant        Reference antenna names. Defaults to the value(s) stored in
                  the pipeline context. If undefined in the pipeline context
                  defaults to the CASA reference antenna naming scheme.
                  
                  Examples: refant='DV01', refant='DV06,DV07'
    solnorm       Normalise the bandpass solution
    minblperant   Minimum number of baselines required per antenna for each
                  solve. Antennas with fewer baselines are excluded from
                  solutions.
    minsnr        Reject solutions below this SNR
    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 just display the command (True)
    acceptresults Add the results of the task to the pipeline context (True) or
                  reject them (False).

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

    
    1. Compute a channel bandpass for all visibility files in the pipeline
    context using the CASA reference antenna determination scheme:
    
    hif_bandpass()
    
    2. Same as the above but precompute a prioritized reference antenna list:
    
    hif_refant()
    hif_bandpass()


    """

    _info_group_ = """pipeline"""
    _info_desc_ = """Compute bandpass calibration solutions"""

    def __call__( self, vis=[  ], caltable=[  ], field='', intent='', spw='', antenna='', phaseup=True, phaseupsolint='int', phaseupbw='', solint='inf', combine='scan', refant='', solnorm=True, minblperant=int(4), minsnr=float(3.0), pipelinemode='automatic', dryrun=False, acceptresults=True ):
        schema = {'vis': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'caltable': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'field': {'type': 'cStr', 'coerce': _coerce.to_str}, 'intent': {'type': 'cStr', 'coerce': _coerce.to_str}, 'spw': {'type': 'cStr', 'coerce': _coerce.to_str}, 'antenna': {'type': 'cStr', 'coerce': _coerce.to_str}, 'phaseup': {'type': 'cBool'}, 'phaseupsolint': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'phaseupbw': {'type': 'cStr', 'coerce': _coerce.to_str}, 'solint': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'combine': {'type': 'cStr', 'coerce': _coerce.to_str}, 'refant': {'type': 'cStr', 'coerce': _coerce.to_str}, 'solnorm': {'type': 'cBool'}, 'minblperant': {'type': 'cInt'}, 'minsnr': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'pipelinemode': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'automatic', 'interactive', 'getinputs' ]}, 'dryrun': {'type': 'cBool'}, 'acceptresults': {'type': 'cBool'}}
        doc = {'vis': vis, 'caltable': caltable, 'field': field, 'intent': intent, 'spw': spw, 'antenna': antenna, 'phaseup': phaseup, 'phaseupsolint': phaseupsolint, 'phaseupbw': phaseupbw, 'solint': solint, 'combine': combine, 'refant': refant, 'solnorm': solnorm, 'minblperant': minblperant, 'minsnr': minsnr, 'pipelinemode': pipelinemode, 'dryrun': dryrun, 'acceptresults': acceptresults}
        assert _pc.validate(doc,schema), str(_pc.errors)
        _logging_state_ = _start_log( 'hif_bandpass', [ 'vis=' + repr(_pc.document['vis']), 'caltable=' + repr(_pc.document['caltable']), 'field=' + repr(_pc.document['field']), 'intent=' + repr(_pc.document['intent']), 'spw=' + repr(_pc.document['spw']), 'antenna=' + repr(_pc.document['antenna']), 'phaseup=' + repr(_pc.document['phaseup']), 'phaseupsolint=' + repr(_pc.document['phaseupsolint']), 'phaseupbw=' + repr(_pc.document['phaseupbw']), 'solint=' + repr(_pc.document['solint']), 'combine=' + repr(_pc.document['combine']), 'refant=' + repr(_pc.document['refant']), 'solnorm=' + repr(_pc.document['solnorm']), 'minblperant=' + repr(_pc.document['minblperant']), 'minsnr=' + repr(_pc.document['minsnr']), 'pipelinemode=' + repr(_pc.document['pipelinemode']), 'dryrun=' + repr(_pc.document['dryrun']), 'acceptresults=' + repr(_pc.document['acceptresults']) ] )
        return _end_log( _logging_state_, 'hif_bandpass', _hif_bandpass_t( _pc.document['vis'], _pc.document['caltable'], _pc.document['field'], _pc.document['intent'], _pc.document['spw'], _pc.document['antenna'], _pc.document['phaseup'], _pc.document['phaseupsolint'], _pc.document['phaseupbw'], _pc.document['solint'], _pc.document['combine'], _pc.document['refant'], _pc.document['solnorm'], _pc.document['minblperant'], _pc.document['minsnr'], _pc.document['pipelinemode'], _pc.document['dryrun'], _pc.document['acceptresults'] ) )

hif_bandpass = _hif_bandpass( )