Source code for pipeline.h.cli.h_export_calstate

##################### generated by xml-casa (v2) from h_export_calstate.xml #########
##################### 6ed8a366d50e0af757fb7a4b68580313 ##############################
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_export_calstate import h_export_calstate as _h_export_calstate_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_export_calstate:
    """
    h_export_calstate ---- Save the pipeline calibration state to disk

    
    h_export_calstate saves the current pipeline calibration state to disk
    in the form of a set of equivalent applycal calls.
    
    If filename is not given, h_export_calstate saves the calibration state to
    disk with a filename based on the pipeline context creation time, using the
    extension '.calstate'
    
    One of two calibration states can be exported: either the active calibration
    state (those calibrations currently applied on-the-fly but scheduled for
    permanent application to the MeasurementSet in a subsequent hif_applycal
    call) or the applied calibration state (calibrations that were previously
    applied to the MeasurementSet using hif_applycal). The default is to export
    the active calibration state.
    
    Issues
    
    If run several times in one pipeline session does the automatic export
    file naming scheme, overwrite previous versions?

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

    filename Name for saved calibration state
    state    The calibration state to export

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

    
    Example
    
    1. Save the calibration state.
    
    h_export_calstate()
    
    2. Save the active calibration state with a custom filename
    
    h_export_calstate(filename='afterbandpass.calstate')
    
    3. Save the applied calibration state with a custom filename
    
    h_export_calstate(filename='applied.calstate', state='applied')


    """

    _info_group_ = """pipeline"""
    _info_desc_ = """Save the pipeline calibration state to disk"""

    def __call__( self, filename='', state='active' ):
        schema = {'filename': {'type': 'cStr', 'coerce': _coerce.to_str}, 'state': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'active', 'applied' ]}}
        doc = {'filename': filename, 'state': state}
        assert _pc.validate(doc,schema), str(_pc.errors)
        _logging_state_ = _start_log( 'h_export_calstate', [ 'filename=' + repr(_pc.document['filename']), 'state=' + repr(_pc.document['state']) ] )
        return _end_log( _logging_state_, 'h_export_calstate', _h_export_calstate_t( _pc.document['filename'], _pc.document['state'] ) )

h_export_calstate = _h_export_calstate( )