##################### generated by xml-casa (v2) from hif_gaincal.xml ###############
##################### fcac17fa025c16f99e6dcf0f126fc24f ##############################
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_gaincal import hif_gaincal as _hif_gaincal_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_gaincal:
"""
hif_gaincal ---- Determine temporal gains from calibrator observations
The complex gains are derived from the data column (raw data) divided by the
model column (usually set with hif_setjy). The gains are obtained for a
specified solution interval, spw combination and field combination.
Good candidate reference antennas can be determined using the hif_refant
task.
Previous calibrations that have been stored in the pipeline context are
applied on the fly. Users can interact with these calibrations via the
hif_export_calstate and hif_import_calstate tasks.
Output
results -- If pipeline mode is 'getinputs' then None is returned. Otherwise
the results object for the pipeline task is returned.
Issues
The 'gspline' (smooth) option is still under development in CASA.
--------- parameter descriptions ---------------------------------------------
vis The list of input MeasurementSets. Defaults to the list of
MeasurementSets specified in the h_init or hif_importdata task.
'': use all MeasurementSets in the context
Examples: 'ngc5921.ms', ['ngc5921a.ms', ngc5921b.ms', 'ngc5921c.ms']
caltable The list of output calibration tables. Defaults to the
standard pipeline naming convention.
Example: caltable=['M82.gcal', 'M82B.gcal']
field The list of field names or field ids for which gain solutions
are to be computed. Defaults to all fields with the standard
intent.
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 *PHASE*.
Examples: intent='', intent='*AMP*,*PHASE*'
spw The list of spectral windows and channels for which gain
solutions are computed. Defaults to all science spectral
windows.
Examples: spw='3C279', spw='3C279, M82'
antenna Set of data selection antenna ids
hm_gaintype The type of gain calibration. The options are 'gtype' and
'gspline' for CASA gain types = 'G' and 'GSPLINE' respectively.
calmode Type of solution. The options are 'ap' (amp and phase), 'p'
(phase only) and 'a' (amp only).
Examples: calmode='p', calmode='a', calmode='ap'
solint Time solution intervals in CASA syntax. Works for
hm_gaintype='gtype' only.
Examples: solint='inf', solint='int', solint='100sec'
combine Data axes to combine for solving. Options are '', 'scan',
'spw', 'field' or any comma-separated combination. Works for
hm_gaintype='gtype' only.
refant Reference antenna name(s) in priority order. Defaults to most
recent values set in the pipeline context. If no reference
antenna is defined in the pipeline context use the CASA
defaults.
Examples: refant='DV01', refant='DV05,DV07'
refantmode Controls how the refant is applied. Currently available
choices are 'flex', 'strict', and the default value of ''.
Setting to '' allows the pipeline to select the appropriate
mode based on the state of the reference antenna list.
Examples: refantmode='strict', refantmode=''
solnorm Normalize average solution amplitudes to 1.0
minblperant Minimum number of baselines required per antenna for each
solve. Antennas with fewer baselines are excluded from
solutions. Works for hm_gaintype='gtype' only.
minsnr Solutions below this SNR are rejected. Works for
hm_gaintype='channel' only.
smodel Point source Stokes parameters for source model (experimental).
Defaults to using standard MODEL_DATA column data.
Example: smodel=[1,0,0,0] - (I=1, unpolarized)
splinetime Spline timescale (sec). Used for hm_gaintype='gspline'.
Typical splinetime should cover about 3 to 5 calibrator scans.
npointaver Tune phase-unwrapping algorithm. Used for
hm_gaintype='gspline'. Keep at default value.
phasewrap Wrap the phase for changes larger than this amount (degrees).
Used for hm_gaintype='gspline'. Keep at default value.
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 just display the command (True)
acceptresults Add the results of the task to the pipeline context (True) or
reject them (False).
--------- examples -----------------------------------------------------------
Compute standard per scan gain solutions that will be used to calibrate
the target:
hif_gaincal()
"""
_info_group_ = """pipeline"""
_info_desc_ = """Determine temporal gains from calibrator observations"""
def __call__( self, vis=[ ], caltable=[ ], field='', intent='', spw='', antenna='', hm_gaintype='gtype', calmode='ap', solint='inf', combine='', refant='', refantmode='', solnorm=False, minblperant=int(4), minsnr=float(3.0), smodel=[ ], splinetime=float(3600.0), npointaver=int(3), phasewrap=float(180.0), pipelinemode='automatic', dryrun=False, acceptresults=True ):
schema = {'vis': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'caltable': {'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}, 'antenna': {'type': 'cStr', 'coerce': _coerce.to_str}, 'hm_gaintype': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'gtype', 'gspline' ]}, 'calmode': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'a', 'p', 'ap' ]}, 'solint': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'combine': {'type': 'cStr', 'coerce': _coerce.to_str}, 'refant': {'type': 'cStr', 'coerce': _coerce.to_str}, 'refantmode': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ '', 'flex', 'strict' ]}, 'solnorm': {'type': 'cBool'}, 'minblperant': {'type': 'cInt'}, 'minsnr': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'smodel': {'type': 'cFloatVec', 'coerce': [_coerce.to_list,_coerce.to_floatvec]}, 'splinetime': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'npointaver': {'type': 'cInt'}, 'phasewrap': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'pipelinemode': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'automatic', 'interactive', 'getinputs' ]}, 'dryrun': {'type': 'cBool'}, 'acceptresults': {'type': 'cBool'}}
doc = {'vis': vis, 'caltable': caltable, 'field': field, 'intent': intent, 'spw': spw, 'antenna': antenna, 'hm_gaintype': hm_gaintype, 'calmode': calmode, 'solint': solint, 'combine': combine, 'refant': refant, 'refantmode': refantmode, 'solnorm': solnorm, 'minblperant': minblperant, 'minsnr': minsnr, 'smodel': smodel, 'splinetime': splinetime, 'npointaver': npointaver, 'phasewrap': phasewrap, 'pipelinemode': pipelinemode, 'dryrun': dryrun, 'acceptresults': acceptresults}
assert _pc.validate(doc,schema), str(_pc.errors)
_logging_state_ = _start_log( 'hif_gaincal', [ 'vis=' + repr(_pc.document['vis']), 'caltable=' + repr(_pc.document['caltable']), 'field=' + repr(_pc.document['field']), 'intent=' + repr(_pc.document['intent']), 'spw=' + repr(_pc.document['spw']), 'antenna=' + repr(_pc.document['antenna']), 'hm_gaintype=' + repr(_pc.document['hm_gaintype']), 'calmode=' + repr(_pc.document['calmode']), 'solint=' + repr(_pc.document['solint']), 'combine=' + repr(_pc.document['combine']), 'refant=' + repr(_pc.document['refant']), 'refantmode=' + repr(_pc.document['refantmode']), 'solnorm=' + repr(_pc.document['solnorm']), 'minblperant=' + repr(_pc.document['minblperant']), 'minsnr=' + repr(_pc.document['minsnr']), 'smodel=' + repr(_pc.document['smodel']), 'splinetime=' + repr(_pc.document['splinetime']), 'npointaver=' + repr(_pc.document['npointaver']), 'phasewrap=' + repr(_pc.document['phasewrap']), 'pipelinemode=' + repr(_pc.document['pipelinemode']), 'dryrun=' + repr(_pc.document['dryrun']), 'acceptresults=' + repr(_pc.document['acceptresults']) ] )
return _end_log( _logging_state_, 'hif_gaincal', _hif_gaincal_t( _pc.document['vis'], _pc.document['caltable'], _pc.document['field'], _pc.document['intent'], _pc.document['spw'], _pc.document['antenna'], _pc.document['hm_gaintype'], _pc.document['calmode'], _pc.document['solint'], _pc.document['combine'], _pc.document['refant'], _pc.document['refantmode'], _pc.document['solnorm'], _pc.document['minblperant'], _pc.document['minsnr'], _pc.document['smodel'], _pc.document['splinetime'], _pc.document['npointaver'], _pc.document['phasewrap'], _pc.document['pipelinemode'], _pc.document['dryrun'], _pc.document['acceptresults'] ) )
hif_gaincal = _hif_gaincal( )