Source code for pipeline.h.cli.h_importdata

##################### generated by xml-casa (v2) from h_importdata.xml ##############
##################### 795b96556326052763b32c35aa3cf694 ##############################
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_h_importdata import h_importdata as _h_importdata_t
from casatasks.private.task_logging import start_log as _start_log
from casatasks.private.task_logging import end_log as _end_log

class _h_importdata:
    """
    h_importdata ---- Imports data into the interferometry pipeline

    
    The h_importdata task loads the specified visibility data into the pipeline
    context unpacking and / or converting it as necessary.
    
    results -- If pipeline mode is 'getinputs' then None is returned. Otherwise
    the results object for the pipeline task is returned.
    

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

    vis               List of visibility data files. These may be ASDMs, tar files of ASDMs,
                      MSs, or tar files of MSs, If ASDM files are specified, they will be
                      converted to MS format.
                      example: vis=['X227.ms', 'asdms.tar.gz']
    session           List of sessions to which the visibility files belong. Defaults to a 
                      single session containing all the visibility files, otherwise
                      a session must be assigned to each vis file.
                      example: session=['session_1', 'session_2']
    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.
    asis              ASDM tables to convert as is
                      default: 'Antenna Station Receiver CalAtmosphere'
                      Can only be set in pipelinemode='interactive'
                      example: 'Receiver', ''
    process_caldevice Ingest the ASDM caldevice table.
                      Can only be set in pipelinemode='interactive'
    overwrite         Overwrite existing MSs on output.
                      Can only be set in pipelinemode='interactive'
    nocopy            When importing an MS, disable copying of the MS to the working
                      directory.  Can only be set in pipelinemode='interactive'.
    bdfflags          Apply BDF flags on import. Can only be set in 
                      pipelinemode='interactive'.
    lazy              Use the lazy import option. Can only be set in
                      pipelinemode='interactive'.
    ocorr_mode        Read in cross- and auto-correlation data(ca), cross-
                      correlation data only (co), or autocorrelation data only (ao).
    createmms         Create a multi-MeasurementSet ('true') ready for parallel
                      processing, or a standard MeasurementSet ('false'). The default setting
                      ('automatic') creates an MMS if running in a cluster environment.
                      Can only be set in pipelinemode='interactive'
    dryrun            Run the task (False) or display task command (True)
    acceptresults     Add the results into the pipeline context

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

    
    Examples
    
    1. Load an ASDM list in the ../rawdata subdirectory into the context"
    
    h_importdata(vis=['../rawdata/uid___A002_X30a93d_X43e',
    '../rawdata/uid_A002_x30a93d_X44e'])
    
    2. Load an MS in the current directory into the context:
    
    h_importdata(vis=[uid___A002_X30a93d_X43e.ms])
    
    3. Load a tarred ASDM in ../rawdata into the context:
    
    h_importdata(vis=['../rawdata/uid___A002_X30a93d_X43e.tar.gz'])
    
    4. Check the h_importdata inputs, then import the data:
    
    myvislist = ['uid___A002_X30a93d_X43e.ms', 'uid_A002_x30a93d_X44e.ms']
    h_importdata(vis=myvislist, pipelinemode='getinputs')
    h_importdata(vis=myvislist)
    
    5. Load an ASDM but check the results before accepting them into the context.
    results = h_importdata(vis=['uid___A002_X30a93d_X43e.ms'],
    acceptresults=False)
    results.accept()
    
    6. Run in dryrun mode before running for real
    results = h_importdata(vis=['uid___A002_X30a93d_X43e.ms'], dryrun=True)
    results = h_importdata(vis=['uid___A002_X30a93d_X43e.ms'])
    


    """

    _info_group_ = """pipeline"""
    _info_desc_ = """Imports data into the interferometry pipeline"""

    def __call__( self, vis=[  ], session=[  ], pipelinemode='automatic', asis='', process_caldevice=False, overwrite=False, nocopy=False, bdfflags=True, lazy=False, ocorr_mode='ca', createmms='automatic', dryrun=False, acceptresults=True ):
        schema = {'vis': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'session': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'pipelinemode': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'automatic', 'interactive', 'getinputs' ]}, 'asis': {'type': 'cStr', 'coerce': _coerce.to_str}, 'process_caldevice': {'type': 'cBool'}, 'overwrite': {'type': 'cBool'}, 'nocopy': {'type': 'cBool'}, 'bdfflags': {'type': 'cBool'}, 'lazy': {'type': 'cBool'}, 'ocorr_mode': {'type': 'cStr', 'coerce': _coerce.to_str}, 'createmms': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'automatic', 'true', 'false' ]}, 'dryrun': {'type': 'cBool'}, 'acceptresults': {'type': 'cBool'}}
        doc = {'vis': vis, 'session': session, 'pipelinemode': pipelinemode, 'asis': asis, 'process_caldevice': process_caldevice, 'overwrite': overwrite, 'nocopy': nocopy, 'bdfflags': bdfflags, 'lazy': lazy, 'ocorr_mode': ocorr_mode, 'createmms': createmms, 'dryrun': dryrun, 'acceptresults': acceptresults}
        assert _pc.validate(doc,schema), str(_pc.errors)
        _logging_state_ = _start_log( 'h_importdata', [ 'vis=' + repr(_pc.document['vis']), 'session=' + repr(_pc.document['session']), 'pipelinemode=' + repr(_pc.document['pipelinemode']), 'asis=' + repr(_pc.document['asis']), 'process_caldevice=' + repr(_pc.document['process_caldevice']), 'overwrite=' + repr(_pc.document['overwrite']), 'nocopy=' + repr(_pc.document['nocopy']), 'bdfflags=' + repr(_pc.document['bdfflags']), 'lazy=' + repr(_pc.document['lazy']), 'ocorr_mode=' + repr(_pc.document['ocorr_mode']), 'createmms=' + repr(_pc.document['createmms']), 'dryrun=' + repr(_pc.document['dryrun']), 'acceptresults=' + repr(_pc.document['acceptresults']) ] )
        return _end_log( _logging_state_, 'h_importdata', _h_importdata_t( _pc.document['vis'], _pc.document['session'], _pc.document['pipelinemode'], _pc.document['asis'], _pc.document['process_caldevice'], _pc.document['overwrite'], _pc.document['nocopy'], _pc.document['bdfflags'], _pc.document['lazy'], _pc.document['ocorr_mode'], _pc.document['createmms'], _pc.document['dryrun'], _pc.document['acceptresults'] ) )

h_importdata = _h_importdata( )