Source code for pipeline.hsdn.cli.hsdn_exportdata

##################### generated by xml-casa (v2) from hsdn_exportdata.xml ###########
##################### c7d9cead98d1b89594bb506d796dbf9c ##############################
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_hsdn_exportdata import hsdn_exportdata as _hsdn_exportdata_t
from casatasks.private.task_logging import start_log as _start_log
from casatasks.private.task_logging import end_log as _end_log

class _hsdn_exportdata:
    """
    hsdn_exportdata ---- Prepare single dish data for export

    
    The hsdn_exportdata task exports the data defined in the pipeline context
    and exports it to the data products directory, converting and or packing
    it as necessary.
    
    The current version of the task exports the following products
    
    o a FITS image for each selected science target source image
    o a tar file per ASDM containing the final flags version and blparam
    o a tar file containing the file web log
    
    TBD
    o a file containing the line feature table(frequency, width, spatial distribution)
    o a file containing the list of identified transitions from line catalogs
    
    Output:
    
    results -- If pipeline mode is 'getinputs' then None is returned. Otherwise
    the results object for the pipeline task is returned.

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

    pprfile       Name of the pipeline processing request to be exported. Defaults
                  to a file matching the template 'PPR_*.xml'.
                  Parameter is not available when pipelinemode='automatic'.
                  example: pprfile=['PPR_GRB021004.xml']
    targetimages  List of science target images to be exported. Defaults to all
                  science target images recorded in the pipeline context.
                  Parameter is not available when pipelinemode='automatic'.
                  example: targetimages=['r_aqr.CM02.spw5.line0.XXYY.sd.im', 'r_aqr.CM02.spw5.XXYY.sd.cont.im']
    products_dir  Name of the data products subdirectory. Defaults to './'
                  Parameter is not available when pipelinemode='automatic'.
                  example: products_dir='../products'
    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 display task command (True).
                  Only available when pipelinemode='interactive'.
    acceptresults Add the results of the task to the pipeline context (True) or
                  reject them (False). Only available when pipelinemode='interactive'.

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

    
    1. Export the pipeline results for a single session to the data products
    directory
    
    !mkdir ../products
    hsdn_exportdata (products_dir='../products')


    """

    _info_group_ = """pipeline"""
    _info_desc_ = """Prepare single dish data for export"""

    def __call__( self, pprfile='', targetimages=[  ], products_dir='', pipelinemode='automatic', dryrun=False, acceptresults=True ):
        schema = {'pprfile': {'type': 'cStr', 'coerce': _coerce.to_str}, 'targetimages': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'products_dir': {'type': 'cStr', 'coerce': _coerce.to_str}, 'pipelinemode': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'automatic', 'interactive', 'getinputs' ]}, 'dryrun': {'type': 'cBool'}, 'acceptresults': {'type': 'cBool'}}
        doc = {'pprfile': pprfile, 'targetimages': targetimages, 'products_dir': products_dir, 'pipelinemode': pipelinemode, 'dryrun': dryrun, 'acceptresults': acceptresults}
        assert _pc.validate(doc,schema), str(_pc.errors)
        _logging_state_ = _start_log( 'hsdn_exportdata', [ 'pprfile=' + repr(_pc.document['pprfile']), 'targetimages=' + repr(_pc.document['targetimages']), 'products_dir=' + repr(_pc.document['products_dir']), 'pipelinemode=' + repr(_pc.document['pipelinemode']), 'dryrun=' + repr(_pc.document['dryrun']), 'acceptresults=' + repr(_pc.document['acceptresults']) ] )
        return _end_log( _logging_state_, 'hsdn_exportdata', _hsdn_exportdata_t( _pc.document['pprfile'], _pc.document['targetimages'], _pc.document['products_dir'], _pc.document['pipelinemode'], _pc.document['dryrun'], _pc.document['acceptresults'] ) )

hsdn_exportdata = _hsdn_exportdata( )