Source code for pipeline.h.cli.hpc_h_applycal

##################### generated by xml-casa (v2) from hpc_h_applycal.xml ############
##################### 2b27e8f4d9f3b02aadb3cee0133f4859 ##############################
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_hpc_h_applycal import hpc_h_applycal as _hpc_h_applycal_t
from casatasks.private.task_logging import start_log as _start_log
from casatasks.private.task_logging import end_log as _end_log

class _hpc_h_applycal:
    """
    hpc_h_applycal ---- Apply the calibration(s) to the data

    
    Apply precomputed calibrations to the data.
    
    hif_applycal applies the precomputed calibration tables stored in the pipeline
    context to the set of visibility files using predetermined field and
    spectral window maps and default values for the interpolation schemes.
    
    Users can interact with the pipeline calibration state using the tasks
    hif_export_calstate and hif_import_calstate.
    
    Issues
    
    There is some discussion about the appropriate values of calwt. Given
    properly scaled data, the correct value should be the CASA default of True.
    However at the current time ALMA is suggesting that calwt be set to True for
    applying observatory calibrations, e.g. antenna positions, WVR, and system
    temperature corrections, and to False for applying instrument calibrations,
    e.g. bandpass, gain, and flux.
    
    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
                    in the pipeline context. Parameter is not available when pipelinemode='automatic'.
                    example: ['X227.ms']
    field           A string containing the list of field names or field ids to which
                    the calibration will be applied. Defaults to all fields in the pipeline
                    context. Parameter is not available when pipelinemode='automatic'.
                    example: '3C279', '3C279, M82'
    intent          A string containing the list of intents against which the
                    selected fields will be matched. Defaults to all supported intents
                    in the pipeline context. Parameter is not available when pipelinemode='automatic'.
                    example: '*TARGET*'
    spw             The list of spectral windows and channels to which the calibration
                    will be applied. Defaults to all science windows in the pipeline
                    context. Parameter is not available when pipelinemode='automatic'.
                    example: '17', '11, 15'
    antenna         The list of antennas to which the calibration will be applied.
                    Defaults to all antennas. Not currently supported.
                    Parameter is not available when pipelinemode='automatic'.
    applymode       Calibration apply mode
                    ''='calflagstrict': calibrate data and apply flags from solutions using
                        the strict flagging convention
                    'trial': report on flags from solutions, dataset entirely unchanged
                    'flagonly': apply flags from solutions only, data not calibrated
                    'calonly': calibrate data only, flags from solutions NOT applied
                    'calflagstrict':
                    'flagonlystrict':same as above except flag spws for which calibration is
                        unavailable in one or more tables (instead of allowing them to pass
                        uncalibrated and unflagged)
    flagbackup      Backup the flags before the apply
    flagsum         Compute before and after flagging summary statistics
    flagdetailedsum Compute detailed before and after flagging statistics summaries.
                    Parameter available only when if flagsum is True.
    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 task (False) or display the command(True).
                    Parameter is available only when pipelinemode='interactive'.
    acceptresults   Add the results of the task to the pipeline context (True) or
                    reject them (False). Parameter is available only when pipelinemode='interactive'.
    parallel        Execute using CASA HPC functionality, if available.

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

    
    1. Apply the calibration to the target data
    
    h_session_applycal(intent='TARGET')
    


    """

    _info_group_ = """pipeline"""
    _info_desc_ = """Apply the calibration(s) to the data"""

    def __call__( self, vis=[  ], field='', intent='', spw='', antenna='', applymode='', flagbackup=True, flagsum=True, flagdetailedsum=False, pipelinemode='', dryrun=False, acceptresults=True, parallel='automatic' ):
        schema = {'vis': {'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}, 'applymode': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'calonly', 'flagonlystrict', 'calflag', 'flagonly', 'trial', '', 'calflagstrict' ]}, 'flagbackup': {'type': 'cBool'}, 'flagsum': {'type': 'cBool'}, 'flagdetailedsum': {'type': 'cBool'}, 'pipelinemode': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'automatic', 'interactive', 'getinputs' ]}, 'dryrun': {'type': 'cBool'}, 'acceptresults': {'type': 'cBool'}, 'parallel': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'automatic', 'true', 'false' ]}}
        doc = {'vis': vis, 'field': field, 'intent': intent, 'spw': spw, 'antenna': antenna, 'applymode': applymode, 'flagbackup': flagbackup, 'flagsum': flagsum, 'flagdetailedsum': flagdetailedsum, 'pipelinemode': pipelinemode, 'dryrun': dryrun, 'acceptresults': acceptresults, 'parallel': parallel}
        assert _pc.validate(doc,schema), str(_pc.errors)
        _logging_state_ = _start_log( 'hpc_h_applycal', [ 'vis=' + repr(_pc.document['vis']), 'field=' + repr(_pc.document['field']), 'intent=' + repr(_pc.document['intent']), 'spw=' + repr(_pc.document['spw']), 'antenna=' + repr(_pc.document['antenna']), 'applymode=' + repr(_pc.document['applymode']), 'flagbackup=' + repr(_pc.document['flagbackup']), 'flagsum=' + repr(_pc.document['flagsum']), 'flagdetailedsum=' + repr(_pc.document['flagdetailedsum']), 'pipelinemode=' + repr(_pc.document['pipelinemode']), 'dryrun=' + repr(_pc.document['dryrun']), 'acceptresults=' + repr(_pc.document['acceptresults']), 'parallel=' + repr(_pc.document['parallel']) ] )
        return _end_log( _logging_state_, 'hpc_h_applycal', _hpc_h_applycal_t( _pc.document['vis'], _pc.document['field'], _pc.document['intent'], _pc.document['spw'], _pc.document['antenna'], _pc.document['applymode'], _pc.document['flagbackup'], _pc.document['flagsum'], _pc.document['flagdetailedsum'], _pc.document['pipelinemode'], _pc.document['dryrun'], _pc.document['acceptresults'], _pc.document['parallel'] ) )

hpc_h_applycal = _hpc_h_applycal( )