Source code for pipeline.hsd.cli.hsd_skycal

##################### generated by xml-casa (v2) from hsd_skycal.xml ################
##################### a80c48afbe05f7a1313eec333fe390d4 ##############################
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_skycal import hsd_skycal as _hsd_skycal_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_skycal:
    """
    hsd_skycal ---- Calibrate data

    The hsd_skycal generates a caltable for sky calibration that stores
    reference spectra, which is to be subtracted from on-source spectra to filter
    out non-source contribution.
    
    Output:
    
    results -- If pipeline mode is 'getinputs' then None is returned. Otherwise
    the results object for the pipeline task is returned.

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

    calmode       Calibration mode. Available options are 'auto' (default),
                  'ps', 'otf', and 'otfraster'. When 'auto' is set, the task will
                  use preset calibration mode that is determined by inspecting data.
                  'ps' mode is simple position switching using explicit reference
                  scans. Other two modes, 'otf' and 'otfraster', will generate
                  reference data from scans at the edge of the map. Those modes
                  are intended for OTF observation and the former is defined for
                  generic scanning pattern such as Lissajous, while the latter is
                  specific use for raster scan.
                  
                  options: 'auto', 'ps', 'otf', 'otfraster'
    fraction      Sub-parameter for calmode. Edge marking parameter for
                  'otf' and 'otfraster' mode. It specifies a number of OFF scans
                  as a fraction of total number of data points.
                  
                  options: String style like '20%', or float value less than 1.0.
                  For 'otfraster' mode, you can also specify 'auto'.
    noff          Sub-parameter for calmode. Edge marking parameter for 'otfraster'
                  mode. It is used to specify a number of OFF scans near edge directly
                  instead to specify it by fractional number by 'fraction'. If it is
                  set, the value will come before setting by 'fraction'.
                  
                  options: any positive integer value
    width         Sub-parameter for calmode. Edge marking parameter for 'otf'
                  mode. It specifies pixel width with respect to a median spatial
                  separation between neighboring two data in time. Default will
                  be fine in most cases.
                  
                  options: any float value
    elongated     Sub-parameter for calmode. Edge marking parameter for
                  'otf' mode. Please set True only if observed area is elongated
                  in one direction.
    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.
    infiles       List of data files. These must be a name of MeasurementSets that
                  are registered to context via hsd_importdata task.
                  
                  example: vis=['X227.ms', 'X228.ms']
    field         Data selection by field name.
    spw           Data selection by spw. (defalut all spws)
                  
                  example: '3,4' (generate caltable for spw 3 and 4)
                          ['0','2'] (spw 0 for first data, 2 for second)
    scan          Data selection by scan number. (default all scans)
                  
                  example: '22,23' (use scan 22 and 23 for calibration)
                          ['22','24'] (scan 22 for first data, 24 for second)
    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. Generate caltables for all data managed by context.
    default(hsd_skycal)
    hsd_skycal()


    """

    _info_group_ = """pipeline"""
    _info_desc_ = """Calibrate data"""

    def __call__( self, calmode='auto', fraction='10%', noff=int(-1), width=float(0.5), elongated=False, pipelinemode='automatic', infiles=[  ], field='', spw='', scan='', dryrun=False, acceptresults=True ):
        schema = {'calmode': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'auto', 'ps', 'otf', 'otfraster' ]}, 'fraction': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'noff': {'type': 'cInt'}, 'width': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'elongated': {'type': 'cBool'}, 'pipelinemode': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'automatic', 'interactive', 'getinputs' ]}, 'infiles': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'field': {'type': 'cStr', 'coerce': _coerce.to_str}, 'spw': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'scan': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'dryrun': {'type': 'cBool'}, 'acceptresults': {'type': 'cBool'}}
        doc = {'calmode': calmode, 'fraction': fraction, 'noff': noff, 'width': width, 'elongated': elongated, 'pipelinemode': pipelinemode, 'infiles': infiles, 'field': field, 'spw': spw, 'scan': scan, 'dryrun': dryrun, 'acceptresults': acceptresults}
        assert _pc.validate(doc,schema), str(_pc.errors)
        _logging_state_ = _start_log( 'hsd_skycal', [ 'calmode=' + repr(_pc.document['calmode']), 'fraction=' + repr(_pc.document['fraction']), 'noff=' + repr(_pc.document['noff']), 'width=' + repr(_pc.document['width']), 'elongated=' + repr(_pc.document['elongated']), 'pipelinemode=' + repr(_pc.document['pipelinemode']), 'infiles=' + repr(_pc.document['infiles']), 'field=' + repr(_pc.document['field']), 'spw=' + repr(_pc.document['spw']), 'scan=' + repr(_pc.document['scan']), 'dryrun=' + repr(_pc.document['dryrun']), 'acceptresults=' + repr(_pc.document['acceptresults']) ] )
        return _end_log( _logging_state_, 'hsd_skycal', _hsd_skycal_t( _pc.document['calmode'], _pc.document['fraction'], _pc.document['noff'], _pc.document['width'], _pc.document['elongated'], _pc.document['pipelinemode'], _pc.document['infiles'], _pc.document['field'], _pc.document['spw'], _pc.document['scan'], _pc.document['dryrun'], _pc.document['acceptresults'] ) )

hsd_skycal = _hsd_skycal( )