##################### generated by xml-casa (v2) from hif_antpos.xml ################
##################### ce31030a08a5f6ddc1d26565d5c6363d ##############################
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_antpos import hif_antpos as _hif_antpos_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_antpos:
"""
hif_antpos ---- Derive an antenna position calibration table
Derive the antenna position calibration for list of MeasurementSets.
The hif_antpos task corrects the antenna positions recorded in the ASDMs using
updated antenna position calibration information determined after the
observation was taken.
Corrections can be input by hand, read from a file on disk, or in the future
by querying an ALMA database service.
The antenna positions file is in 'csv' format containing 6 comma-delimited
columns as shown below. The default name of this file is 'antennapos.csv'.
Contents of example 'antennapos.csv' file:
ms,antenna,xoffset,yoffset,zoffset,comment
uid___A002_X30a93d_X43e.ms,DV11,0.000,0.010,0.000,"No comment"
uid___A002_X30a93d_X43e.dup.ms,DV11,0.000,-0.010,0.000,"No comment"
The corrections are used to generate a calibration table which is recorded
in the pipeline context and applied to the raw visibility data, on the fly to
generate other calibration tables, or permanently to generate calibrated
visibilities for imaging.
Issues
The hm_antpos 'online' option will be implemented when the observing system
provides an antenna position determination service.
Output
results -- If pipeline mode is 'getinputs' then None is returned. Otherwise
the results object for the pipeline task is returned.
--------- parameter descriptions ---------------------------------------------
vis List of input visibility files.
Not available when pipelinemode='automatic'.
example: ['ngc5921.ms']
caltable Name of output gain calibration tables.
Not available when pipelinemode='automatic'.
example: ['ngc5921.gcal']
hm_antpos Heuristics method for retrieving the antenna position
corrections. The options are 'online' (not yet implemented), 'manual',
and 'file'.
antenna The list of antennas for which the positions are to be corrected.
Available when hm_antpos='manual'.
example: antenna='DV05,DV07'
offsets The list of antenna offsets for each antenna in 'antennas'. Each
offset is a set of 3 floating point numbers separated by commas, specified
in the ITRF frame. Available when hm_antpos='manual'.
example: offsets=[0.01, 0.02, 0.03, 0.03, 0.02, 0.01]
antposfile The file(s) containing the antenna offsets. Used if hm_antpos
is 'file'.
example: 'antennapos.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.
dryrun Run the task (False) or list commands (True).
Available when pipelinemode='interactive'.
acceptresults Add the results of the task to the pipeline context (True) or
reject them (False). Available when pipelinemode='interactive'.
--------- examples -----------------------------------------------------------
1. Correct the position of antenna 5 for all the visibility files in a single
pipeline run:
hif_antpos(antenna='DV05', offsets=[0.01, 0.02, 0.03])
2. Correct the position of antennas for all the visibility files in a single
pipeline run using antenna positions files on disk. These files are assumed
to conform to a default naming scheme if 'antposfile' is unspecified by the
user:
hif_antpos(hm_antpos='file', antposfile='myantposfile.csv')
"""
_info_group_ = """pipeline"""
_info_desc_ = """Derive an antenna position calibration table"""
def __call__( self, vis=[ ], caltable=[ ], hm_antpos='manual', antenna='', offsets=[ ], antposfile='', 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]}, 'hm_antpos': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'manual', 'file', 'online' ]}, 'antenna': {'type': 'cStr', 'coerce': _coerce.to_str}, 'offsets': {'type': 'cFloatVec', 'coerce': [_coerce.to_list,_coerce.to_floatvec]}, 'antposfile': {'type': 'cStr', 'coerce': _coerce.to_str}, 'pipelinemode': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'automatic', 'interactive', 'getinputs' ]}, 'dryrun': {'type': 'cBool'}, 'acceptresults': {'type': 'cBool'}}
doc = {'vis': vis, 'caltable': caltable, 'hm_antpos': hm_antpos, 'antenna': antenna, 'offsets': offsets, 'antposfile': antposfile, 'pipelinemode': pipelinemode, 'dryrun': dryrun, 'acceptresults': acceptresults}
assert _pc.validate(doc,schema), str(_pc.errors)
_logging_state_ = _start_log( 'hif_antpos', [ 'vis=' + repr(_pc.document['vis']), 'caltable=' + repr(_pc.document['caltable']), 'hm_antpos=' + repr(_pc.document['hm_antpos']), 'antenna=' + repr(_pc.document['antenna']), 'offsets=' + repr(_pc.document['offsets']), 'antposfile=' + repr(_pc.document['antposfile']), 'pipelinemode=' + repr(_pc.document['pipelinemode']), 'dryrun=' + repr(_pc.document['dryrun']), 'acceptresults=' + repr(_pc.document['acceptresults']) ] )
return _end_log( _logging_state_, 'hif_antpos', _hif_antpos_t( _pc.document['vis'], _pc.document['caltable'], _pc.document['hm_antpos'], _pc.document['antenna'], _pc.document['offsets'], _pc.document['antposfile'], _pc.document['pipelinemode'], _pc.document['dryrun'], _pc.document['acceptresults'] ) )
hif_antpos = _hif_antpos( )