Source code for pipeline.hifa.cli.hifa_timegaincal

##################### generated by xml-casa (v2) from hifa_timegaincal.xml ##########
##################### 87c20af92490128b22f8350b74593e2f ##############################
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_timegaincal import hifa_timegaincal as _hifa_timegaincal_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_timegaincal:
    """
    hifa_timegaincal ---- Determine temporal gains from calibrator observations

    
    The time-dependent complex gains for each antenna/spwid are determined
    from the raw data (DATA column) divided by the model (MODEL column), for the
    specified fields. The gains are computed independently for each specified
    spectral window. One gain solution is computed for the calibrator source
    targets and one for the science targets.
    
    Previous calibrations are applied on the fly.
    
    
    The complex gains are derived from the data column (raw data) divided by the
    model column (usually set with hif_setjy). The gains are obtained for the
    specified solution intervals, spw combination and field combination. One gain
    solution is computed for the science targets and one for the calibrator
    targets.
    
    Good candidate reference antennas can be determined using the hif_refant
    task.
    
    Previous calibrations that have been stored in the pipeline context are
    applied on the fly. Users can interact with these calibrations via the
    hif_export_calstate and hif_import_calstate tasks.
    
    
    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 pipeline context.
                     
                     example: vis=['M82A.ms', 'M82B.ms']
    calamptable      The list of output diagnostic calibration amplitude tables for
                     the calibration targets. Defaults to the standard pipeline naming
                     convention.
                     
                     example: calamptable=['M82.gacal', 'M82B.gacal']
    offsetstable     The list of output diagnostic phase offset tables for the
                     calibration targets. Defaults to the standard pipeline naming convention.
                     
                     example: offsetstable=['M82.offsets.gacal', 'M82B.offsets.gacal']
    calphasetable    The list of output calibration phase tables for the
                     calibration targets. Defaults to the standard pipeline naming convention.
                     
                     example: calphasetable=['M82.gcal', 'M82B.gcal']
    targetphasetable The list of output phase calibration tables for the science
                     targets. Defaults to the standard pipeline naming convention.
                     
                     example: targetphasetable=['M82.gcal', 'M82B.gcal']
    amptable         The list of output calibration amplitude tables for the
                     calibration and science targets.
                     Defaults to the standard pipeline naming convention.
                     
                     example: amptable=['M82.gcal', 'M82B.gcal']
    field            The list of field names or field ids for which gain solutions are to
                     be computed. Defaults to all fields with the standard intent.
                     
                     example: field='3C279', field='3C279, M82'
    intent           A string containing a comma delimited list of intents against which
                     the selected fields are matched. Defaults to the equivalent of
                     'AMPLITUDE,PHASE,BANDPASS'.
                     
                     example: intent='', intent='PHASE'
    spw              The list of spectral windows and channels for which gain solutions are
                     computed. Defaults to all science spectral windows.
                     
                     example: spw='3C279', spw='3C279, M82'
    antenna          
    calsolint        Time solution interval in CASA syntax for calibrator source
                     solutions.
                     
                     example: calsolint='inf', calsolint='int', calsolint='100sec'
    targetsolint     Time solution interval in CASA syntax for target source
                     solutions.
                     
                     example: targetsolint='inf', targetsolint='int', targetsolint='100sec'
    combine          Data axes to combine for solving. Options are '', 'scan', 'spw',
                     'field' or any comma-separated combination.
                     
                     default: ''
                     example: combine=''
    refant           Reference antenna name(s) in priority order. Defaults to most recent
                     values set in the pipeline context.  If no reference antenna is defined in
                     the pipeline context use the CASA defaults.
                     
                     example: refant='DV01', refant='DV05,DV07'
    refantmode       Controls how the refant is applied. Currently available
                     choices are 'flex', 'strict', and the default value of ''.
                     Setting to '' allows the pipeline to select the appropriate
                     mode based on the state of the reference antenna list.
                     
                     Examples: refantmode='strict', refantmode=''
    solnorm          Normalise the gain solutions.
    minblperant      Minimum number of baselines required per antenna for each solve.
                     Antennas with fewer baselines are excluded from solutions.
                     
                     example: minblperant=2
    calminsnr        Solutions below this SNR are rejected for calibrator solutions.
    targetminsnr     Solutions below this SNR are rejected for science target
                     solutions.
    smodel           Point source Stokes parameters for source model (experimental)
                     Defaults to using standard MODEL_DATA column data.
                     
                     example: smodel=[1,0,0,0]  - (I=1, unpolarized)
    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 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. Compute standard per scan gain solutions that will be used to calibrate
    the target:
    
    hifa_timegaincal()


    """

    _info_group_ = """pipeline"""
    _info_desc_ = """Determine temporal gains from calibrator observations"""

    def __call__( self, vis=[  ], calamptable=[  ], offsetstable=[  ], calphasetable=[  ], targetphasetable=[  ], amptable=[  ], field='', intent='', spw='', antenna='', calsolint='int', targetsolint='inf', combine='', refant='', refantmode='', solnorm=False, minblperant=int(4), calminsnr=float(2.0), targetminsnr=float(3.0), smodel=[  ], pipelinemode='automatic', dryrun=False, acceptresults=True ):
        schema = {'vis': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'calamptable': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'offsetstable': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'calphasetable': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'targetphasetable': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'amptable': {'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}, 'calsolint': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'targetsolint': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'combine': {'type': 'cStr', 'coerce': _coerce.to_str}, 'refant': {'type': 'cStr', 'coerce': _coerce.to_str}, 'refantmode': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ '', 'flex', 'strict' ]}, 'solnorm': {'type': 'cBool'}, 'minblperant': {'type': 'cInt'}, 'calminsnr': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'targetminsnr': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'smodel': {'type': 'cFloatVec', 'coerce': [_coerce.to_list,_coerce.to_floatvec]}, 'pipelinemode': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'automatic', 'interactive', 'getinputs' ]}, 'dryrun': {'type': 'cBool'}, 'acceptresults': {'type': 'cBool'}}
        doc = {'vis': vis, 'calamptable': calamptable, 'offsetstable': offsetstable, 'calphasetable': calphasetable, 'targetphasetable': targetphasetable, 'amptable': amptable, 'field': field, 'intent': intent, 'spw': spw, 'antenna': antenna, 'calsolint': calsolint, 'targetsolint': targetsolint, 'combine': combine, 'refant': refant, 'refantmode': refantmode, 'solnorm': solnorm, 'minblperant': minblperant, 'calminsnr': calminsnr, 'targetminsnr': targetminsnr, 'smodel': smodel, 'pipelinemode': pipelinemode, 'dryrun': dryrun, 'acceptresults': acceptresults}
        assert _pc.validate(doc,schema), str(_pc.errors)
        _logging_state_ = _start_log( 'hifa_timegaincal', [ 'vis=' + repr(_pc.document['vis']), 'calamptable=' + repr(_pc.document['calamptable']), 'offsetstable=' + repr(_pc.document['offsetstable']), 'calphasetable=' + repr(_pc.document['calphasetable']), 'targetphasetable=' + repr(_pc.document['targetphasetable']), 'amptable=' + repr(_pc.document['amptable']), 'field=' + repr(_pc.document['field']), 'intent=' + repr(_pc.document['intent']), 'spw=' + repr(_pc.document['spw']), 'antenna=' + repr(_pc.document['antenna']), 'calsolint=' + repr(_pc.document['calsolint']), 'targetsolint=' + repr(_pc.document['targetsolint']), 'combine=' + repr(_pc.document['combine']), 'refant=' + repr(_pc.document['refant']), 'refantmode=' + repr(_pc.document['refantmode']), 'solnorm=' + repr(_pc.document['solnorm']), 'minblperant=' + repr(_pc.document['minblperant']), 'calminsnr=' + repr(_pc.document['calminsnr']), 'targetminsnr=' + repr(_pc.document['targetminsnr']), 'smodel=' + repr(_pc.document['smodel']), 'pipelinemode=' + repr(_pc.document['pipelinemode']), 'dryrun=' + repr(_pc.document['dryrun']), 'acceptresults=' + repr(_pc.document['acceptresults']) ] )
        return _end_log( _logging_state_, 'hifa_timegaincal', _hifa_timegaincal_t( _pc.document['vis'], _pc.document['calamptable'], _pc.document['offsetstable'], _pc.document['calphasetable'], _pc.document['targetphasetable'], _pc.document['amptable'], _pc.document['field'], _pc.document['intent'], _pc.document['spw'], _pc.document['antenna'], _pc.document['calsolint'], _pc.document['targetsolint'], _pc.document['combine'], _pc.document['refant'], _pc.document['refantmode'], _pc.document['solnorm'], _pc.document['minblperant'], _pc.document['calminsnr'], _pc.document['targetminsnr'], _pc.document['smodel'], _pc.document['pipelinemode'], _pc.document['dryrun'], _pc.document['acceptresults'] ) )

hifa_timegaincal = _hifa_timegaincal( )