Source code for pipeline.hsd.cli.hsd_k2jycal

##################### generated by xml-casa (v2) from hsd_k2jycal.xml ###############
##################### add86d5640eafa47cc98be25a3d73854 ##############################
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_k2jycal import hsd_k2jycal as _hsd_k2jycal_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_k2jycal:
    """
    hsd_k2jycal ---- Derive Kelvin to Jy calibration tables

    
    Derive the Kelvin to Jy calibration for list of MeasurementSets.
    
    results -- If pipeline mode is 'getinputs' then None is returned. Otherwise
    the results object for the pipeline task is returned.

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

    dbservice     Whether or not accessing Jy/K DB to retrieve conversion factors.
    endpoint      Which endpoints to use for query
                  options: 'asdm', 'model-fit', 'interpolation'
    reffile       Path to a file containing Jy/K factors for science data, which
                  must be provided by associating calibrator reduction or the observatory
                  measurements. Jy/K factor must take into account all efficiencies, i.e.,
                  it must be a direct conversion factor from Ta* to Jy. The file must be
                  in either MS-based or session-based format. The MS-based format must
                  be in an CSV format with five fields: MS name, antenna name, spectral
                  window id, polarization string, and Jy/K conversion factor. Example for
                  the file is as follows:
                  
                      MS,Antenna,Spwid,Polarization,Factor
                      uid___A002_X316307_X6f.ms,CM03,5,XX,10.0
                      uid___A002_X316307_X6f.ms,CM03,5,YY,12.0
                      uid___A002_X316307_X6f.ms,PM04,5,XX,2.0
                      uid___A002_X316307_X6f.ms,PM04,5,YY,5.0
                  
                  The first line in the above example is a header which may or may not
                  exist. Example for the session-based format is as follows:
                  
                      #OUSID=XXXXXX
                      #OBJECT=Uranus
                      #FLUXJY=yy,zz,aa
                      #FLUXFREQ=YY,ZZ,AA
                      #sessionID,ObservationStartDate(UTC),ObservationEndDate(UTC),Antenna,BandCenter(MHz),BandWidth(MHz),POL,Factor
                      1,2011-11-11 01:00:00,2011-11-11 01:30:00,CM02,86243.0,500.0,I,10.0
                      1,2011-11-11 01:00:00,2011-11-11 01:30:00,CM02,86243.0,1000.0,I,30.0
                      1,2011-11-11 01:00:00,2011-11-11 01:30:00,CM03,86243.0,500.0,I,50.0
                      1,2011-11-11 01:00:00,2011-11-11 01:30:00,CM03,86243.0,1000.0,I,70.0
                      1,2011-11-11 01:00:00,2011-11-11 01:30:00,ANONYMOUS,86243.0,500.0,I,30.0
                      1,2011-11-11 01:00:00,2011-11-11 01:30:00,ANONYMOUS,86243.0,1000.0,I,50.0
                      2,2011-11-13 01:45:00,2011-11-13 02:15:00,PM04,86243.0,500.0,I,90.0
                      2,2011-11-13 01:45:00,2011-11-13 02:15:00,PM04,86243.0,1000.0,I,110.0
                      2,2011-11-13 01:45:00,2011-11-13 02:15:00,ANONYMOUS,86243.0,500.0,I,90.0
                      2,2011-11-13 01:45:00,2011-11-13 02:15:00,ANONYMOUS,86243.0,1000.0,I,110.0
                  
                  The line starting with '#' indicates a meta data section and header.
                  The header must exist. The factor to apply is identified by matching the
                  session ID, antenna name, frequency and polarization of data in each line of
                  the file. Note the observation date is supplementary information and not used
                  for the matching so far. The lines whose antenna name is 'ANONYMOUS' are used
                  when there is no measurement for specific antenna in the session. In the above
                  example, if science observation of session 1 contains the antenna PM04, Jy/K
                  factor for ANONYMOUS antenna will be applied since there is no measurement for
                  PM04 in session 1.
                  If no file name is specified or specified file doesn't exist, all Jy/K factors
                  are set to 1.0.
                  
                  example: reffile='', reffile='working/jyperk.csv'
    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 input MeasurementSets.
                  
                  example: vis='ngc5921.ms'
    caltable      Name of output gain calibration tables.
                  
                  example: caltable='ngc5921.gcal'
    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. Compute the Kevin to Jy calibration tables for a list of MeasurementSets:
    
    hsd_k2jycal()


    """

    _info_group_ = """pipeline"""
    _info_desc_ = """Derive Kelvin to Jy calibration tables"""

    def __call__( self, dbservice=False, endpoint='asdm', reffile='jyperk.csv', pipelinemode='automatic', infiles=[  ], caltable=[  ], dryrun=False, acceptresults=True ):
        schema = {'dbservice': {'type': 'cBool'}, 'endpoint': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'asdm', 'model-fit', 'interpolation' ]}, 'reffile': {'type': 'cStr', 'coerce': _coerce.to_str}, 'pipelinemode': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'automatic', 'interactive', 'getinputs' ]}, 'infiles': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'caltable': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'dryrun': {'type': 'cBool'}, 'acceptresults': {'type': 'cBool'}}
        doc = {'dbservice': dbservice, 'endpoint': endpoint, 'reffile': reffile, 'pipelinemode': pipelinemode, 'infiles': infiles, 'caltable': caltable, 'dryrun': dryrun, 'acceptresults': acceptresults}
        assert _pc.validate(doc,schema), str(_pc.errors)
        _logging_state_ = _start_log( 'hsd_k2jycal', [ 'dbservice=' + repr(_pc.document['dbservice']), 'endpoint=' + repr(_pc.document['endpoint']), 'reffile=' + repr(_pc.document['reffile']), 'pipelinemode=' + repr(_pc.document['pipelinemode']), 'infiles=' + repr(_pc.document['infiles']), 'caltable=' + repr(_pc.document['caltable']), 'dryrun=' + repr(_pc.document['dryrun']), 'acceptresults=' + repr(_pc.document['acceptresults']) ] )
        return _end_log( _logging_state_, 'hsd_k2jycal', _hsd_k2jycal_t( _pc.document['dbservice'], _pc.document['endpoint'], _pc.document['reffile'], _pc.document['pipelinemode'], _pc.document['infiles'], _pc.document['caltable'], _pc.document['dryrun'], _pc.document['acceptresults'] ) )

hsd_k2jycal = _hsd_k2jycal( )