Source code for pipeline.hif.cli.hif_setjy

##################### generated by xml-casa (v2) from hif_setjy.xml #################
##################### 4d5ce1c54d2fcf000e52e608b1c3e070 ##############################
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_hif_setjy import hif_setjy as _hif_setjy_t
from casatasks.private.task_logging import start_log as _start_log
from casatasks.private.task_logging import end_log as _end_log

class _hif_setjy:
    """
    hif_setjy ---- Fill the model column with calibrated visibilities

    
    Fills the model column with the model visibilities.
    
    
    Issues
    
    Support for the setjy spix parameter needs to be added.
    
    
    Output
    
    results -- If pipeline mode is 'getinputs' then None is returned. Otherwise
    the results object for the pipeline task is returned.

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

    vis           The list of input MeasurementSets. Defaults to the list of
                  MeasurementSets defined in the pipeline context.
    field         The list of field names or field ids for which the models are
                  to be set. Defaults to all fields with intent '*AMPLITUDE*'.
                  
                  example: field='3C279', field='3C279, M82'
    intent        A string containing a comma delimited list of intents against
                  which the selected fields are matched. Defaults to all data
                  with amplitude intent.
                  
                  example: intent='*AMPLITUDE*'
    spw           The list of spectral windows and channels for which bandpasses are
                  computed. Defaults to all science spectral windows.
                  
                  example: spw='11,13,15,17'
    model         Model image for setting model visibilities. Not fully
                  supported.
                  
                  example: see details in help for CASA setjy task
    reffile       Path to a file containing flux densities for calibrators unknown to
                  CASA. Values given in this file take precedence over the CASA-derived
                  values for all calibrators except solar system calibrators. By default the
                  path is set to the CSV file created by h_importdata, consisting of
                  catalogue fluxes extracted from the ASDM.
                  
                  example: reffile='', reffile='working/flux.csv'
    normfluxes    Normalize lookup fluxes.
    reffreq       The reference frequency for spix, given with units. Provided to
                  avoid division by zero. If the flux density is being scaled by spectral
                  index, then reffreq must be set to whatever reference frequency is correct
                  for the given fluxdensity and spix. It cannot be determined from vis. On
                  the other hand, if spix is 0, then any positive frequency can be used and
                  will be ignored.
                  
                  example: reffreq='86.0GHz', reffreq='4.65e9Hz'
    fluxdensity   Specified flux density [I,Q,U,V] in Jy. Uses [1,0,0,0]
                  flux density for unrecognized sources, and standard flux densities for
                  ones recognized by 'standard', including 3C286, 3C48, 3C147, and several
                  planets, moons, and asteroids.
                  
                  example: [3.06,0.0,0.0,0.0]
    spix          Spectral index for fluxdensity S = fluxdensity * (freq/reffreq)**spix
                  Only used if fluxdensity is being used. If fluxdensity is positive, and
                  spix is nonzero, then reffreq must be set too. It is applied in the same
                  way to all polarizations, and does not account for Faraday rotation or
                  depolarization.
    scalebychan   This determines whether the fluxdensity set in the model is
                  calculated on a per channel basis. If False then only one fluxdensity
                  value is calculated per spw.
    standard      Flux density standard, used if fluxdensity[0] less than 0.0. The
                  options are: 'Baars','Perley 90','Perley-Taylor 95', 'Perley-Taylor 99',
                  'Perley-Butler 2010' and 'Butler-JPL-Horizons 2010'.
                  
                  default: 'Butler-JPL-Horizons 2012' for solar system object
                                           'Perley-Butler 2010' otherwise
    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.
                  
                  default: 'automatic'.
    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. Set the model flux densities for all the amplitude calibrators:
    
    hif_setjy()


    """

    _info_group_ = """pipeline"""
    _info_desc_ = """Fill the model column with calibrated visibilities"""

    def __call__( self, vis=[  ], field='', intent='', spw='', model='', reffile='', normfluxes=False, reffreq='1GHz', fluxdensity=int(-1), spix=float(0.0), scalebychan=True, standard='', pipelinemode='automatic', dryrun=False, acceptresults=True ):
        schema = {'vis': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'field': {'type': 'cStr', 'coerce': _coerce.to_str}, 'intent': {'type': 'cStr', 'coerce': _coerce.to_str}, 'spw': {'type': 'cStr', 'coerce': _coerce.to_str}, 'model': {'type': 'cStr', 'coerce': _coerce.to_str}, 'reffile': {'type': 'cStr', 'coerce': _coerce.to_str}, 'normfluxes': {'type': 'cBool'}, 'reffreq': {'type': 'cStr', 'coerce': _coerce.to_str}, 'fluxdensity': {'anyof': [{'type': 'cInt'}, {'type': 'cIntVec', 'coerce': [_coerce.to_list,_coerce.to_intvec]}, {'type': 'cFloatVec', 'coerce': [_coerce.to_list,_coerce.to_floatvec]}]}, 'spix': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'scalebychan': {'type': 'cBool'}, 'standard': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'pipelinemode': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'automatic', 'interactive', 'getinputs' ]}, 'dryrun': {'type': 'cBool'}, 'acceptresults': {'type': 'cBool'}}
        doc = {'vis': vis, 'field': field, 'intent': intent, 'spw': spw, 'model': model, 'reffile': reffile, 'normfluxes': normfluxes, 'reffreq': reffreq, 'fluxdensity': fluxdensity, 'spix': spix, 'scalebychan': scalebychan, 'standard': standard, 'pipelinemode': pipelinemode, 'dryrun': dryrun, 'acceptresults': acceptresults}
        assert _pc.validate(doc,schema), str(_pc.errors)
        _logging_state_ = _start_log( 'hif_setjy', [ 'vis=' + repr(_pc.document['vis']), 'field=' + repr(_pc.document['field']), 'intent=' + repr(_pc.document['intent']), 'spw=' + repr(_pc.document['spw']), 'model=' + repr(_pc.document['model']), 'reffile=' + repr(_pc.document['reffile']), 'normfluxes=' + repr(_pc.document['normfluxes']), 'reffreq=' + repr(_pc.document['reffreq']), 'fluxdensity=' + repr(_pc.document['fluxdensity']), 'spix=' + repr(_pc.document['spix']), 'scalebychan=' + repr(_pc.document['scalebychan']), 'standard=' + repr(_pc.document['standard']), 'pipelinemode=' + repr(_pc.document['pipelinemode']), 'dryrun=' + repr(_pc.document['dryrun']), 'acceptresults=' + repr(_pc.document['acceptresults']) ] )
        return _end_log( _logging_state_, 'hif_setjy', _hif_setjy_t( _pc.document['vis'], _pc.document['field'], _pc.document['intent'], _pc.document['spw'], _pc.document['model'], _pc.document['reffile'], _pc.document['normfluxes'], _pc.document['reffreq'], _pc.document['fluxdensity'], _pc.document['spix'], _pc.document['scalebychan'], _pc.document['standard'], _pc.document['pipelinemode'], _pc.document['dryrun'], _pc.document['acceptresults'] ) )

hif_setjy = _hif_setjy( )