##################### generated by xml-casa (v2) from hifa_gfluxscale.xml ###########
##################### 14474d323db3bbc71601c88c1026f415 ##############################
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_hifa_gfluxscale import hifa_gfluxscale as _hifa_gfluxscale_t
from casatasks.private.task_logging import start_log as _start_log
from casatasks.private.task_logging import end_log as _end_log
class _hifa_gfluxscale:
"""
hifa_gfluxscale ---- Derive flux density scales from standard calibrators
Derive flux densities for point source transfer calibrators using flux models
for reference calibrators.
Flux values are determined by:
o computing complex gain phase only solutions for all the science spectral
windows using the calibrator data selected by the 'reference' and
'refintent' parameters and the 'transfer' and 'transintent' parameters,
and the value of the 'phaseupsolint' parameter.
o computing complex amplitude only solutions for all the science spectral
windows using calibrator data selected with 'reference' and 'refintent'
parameters and the 'transfer' and 'transintent' parameters, the value
of the 'solint' parameter.
o transferring the flux scale from the reference calibrators to the transfer
calibrators using refspwmap for windows without data in the reference
calibrators
o extracted the computed flux values from the CASA logs and inserting
them into the MODEL_DATA column.
Resolved calibrators are handled via antenna selection either automatically,
hm_resolvedcals='automatic' or manually, hm_resolvedcals='manual'. In
the former case antennas closer to the reference antenna than the uv
distance where visibilities fall to 'peak_fraction' of the peak are used.
In manual mode the antennas specified in 'antenna' are used.
Note that the flux corrected calibration table computed internally is
not currently used in later pipeline apply calibration steps.
Issues
Should we add a spw window selection option here?
The code which extracts the flux scales from the logs needs to be replaced
with code which uses the values returned from the CASA fluxscale task.
--------- parameter descriptions ---------------------------------------------
vis The list of input MeasurementSets. Defaults to the list of MeasurementSets
specified in the pipeline context
example: ['M32A.ms', 'M32B.ms']
reference A string containing a comma delimited list of field names
defining the reference calibrators. Defaults to field names with
intent '*AMP*'.
example: reference='M82,3C273'
transfer A string containing a comma delimited list of field names
defining the transfer calibrators. Defaults to field names with
intent '*PHASE*'.
example: transfer='J1328+041,J1206+30'
refintent A string containing a comma delimited list of intents
used to select the reference calibrators. Defaults to 'AMPLITUDE'.
example: refintent='', refintent='AMPLITUDE'
transintent A string containing a comma delimited list of intents
defining the transfer calibrators. Defaults to
'PHASE,BANDPASS,CHECK,POLARIZATION,POLANGLE,POLLEAKAGE'.
example: transintent='', transintent='PHASE,BANDPASS'
refspwmap Vector of spectral window ids enabling scaling across
spectral windows. Defaults to no scaling.
example: refspwmap=[1,1,3,3] - (4 spws, reference fields in 1 and 3, transfer
fields in 0,1,2,3
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 hifa_importdata, consisting of
catalogue fluxes extracted from the ASDM and / or edited by the user.
example: reffile='', reffile='working/flux.csv'
phaseupsolint Time solution intervals in CASA syntax for the phase solution.
example: phaseupsolint='inf', phaseupsolint='int', phaseupsolint='100sec'
solint Time solution intervals in CASA syntax for the amplitude solution.
example: solint='inf', solint='int', solint='100sec'
minsnr Minimum signal to noise ratio for gain calibration solutions.
example: minsnr=1.5, minsnr=0.0
refant A string specifying the reference antenna(s). By default this is read
from the context.
example: refant='DV05'
hm_resolvedcals Heuristics method for handling resolved calibrators. The
options are 'automatic' and 'manual'. In automatic mode antennas closer
to the reference antenna than the uv distance where visibilities fall to
'peak_fraction' of the peak are used. In manual mode the antennas specified
in 'antenna' are used.
antenna A comma delimited string specifying the antenna names or ids to be
used for the fluxscale determination. Used in hm_resolvedcals='manual' mode.
example: antenna='DV16,DV07,DA12,DA08'
peak_fraction The limiting UV distance from the reference antenna for antennas
to be included in the flux calibration. Defined as the point where the
calibrator visibilities have fallen to 'peak_fraction' of the peak 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 users can check the settings
of all pipeline parameters without running the task.
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 flux values for the phase calibrator using model data from
the amplitude calibrator:
hifa_gfluxscale()
"""
_info_group_ = """pipeline"""
_info_desc_ = """Derive flux density scales from standard calibrators"""
def __call__( self, vis='', reference='', transfer='', refintent='', transintent='', refspwmap=[ ], reffile='', phaseupsolint='int', solint='inf', minsnr=float(2.0), refant='', hm_resolvedcals='automatic', antenna='', peak_fraction=float(0.2), pipelinemode='automatic', dryrun=False, acceptresults=True ):
schema = {'vis': {'type': 'cStr', 'coerce': _coerce.to_str}, 'reference': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'transfer': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'refintent': {'type': 'cStr', 'coerce': _coerce.to_str}, 'transintent': {'type': 'cStr', 'coerce': _coerce.to_str}, 'refspwmap': {'type': 'cIntVec', 'coerce': [_coerce.to_list,_coerce.to_intvec]}, 'reffile': {'type': 'cStr', 'coerce': _coerce.to_str}, 'phaseupsolint': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'solint': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'minsnr': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'refant': {'type': 'cStr', 'coerce': _coerce.to_str}, 'hm_resolvedcals': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'automatic', 'manual' ]}, 'antenna': {'type': 'cStr', 'coerce': _coerce.to_str}, 'peak_fraction': {'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, 'reference': reference, 'transfer': transfer, 'refintent': refintent, 'transintent': transintent, 'refspwmap': refspwmap, 'reffile': reffile, 'phaseupsolint': phaseupsolint, 'solint': solint, 'minsnr': minsnr, 'refant': refant, 'hm_resolvedcals': hm_resolvedcals, 'antenna': antenna, 'peak_fraction': peak_fraction, 'pipelinemode': pipelinemode, 'dryrun': dryrun, 'acceptresults': acceptresults}
assert _pc.validate(doc,schema), str(_pc.errors)
_logging_state_ = _start_log( 'hifa_gfluxscale', [ 'vis=' + repr(_pc.document['vis']), 'reference=' + repr(_pc.document['reference']), 'transfer=' + repr(_pc.document['transfer']), 'refintent=' + repr(_pc.document['refintent']), 'transintent=' + repr(_pc.document['transintent']), 'refspwmap=' + repr(_pc.document['refspwmap']), 'reffile=' + repr(_pc.document['reffile']), 'phaseupsolint=' + repr(_pc.document['phaseupsolint']), 'solint=' + repr(_pc.document['solint']), 'minsnr=' + repr(_pc.document['minsnr']), 'refant=' + repr(_pc.document['refant']), 'hm_resolvedcals=' + repr(_pc.document['hm_resolvedcals']), 'antenna=' + repr(_pc.document['antenna']), 'peak_fraction=' + repr(_pc.document['peak_fraction']), 'pipelinemode=' + repr(_pc.document['pipelinemode']), 'dryrun=' + repr(_pc.document['dryrun']), 'acceptresults=' + repr(_pc.document['acceptresults']) ] )
return _end_log( _logging_state_, 'hifa_gfluxscale', _hifa_gfluxscale_t( _pc.document['vis'], _pc.document['reference'], _pc.document['transfer'], _pc.document['refintent'], _pc.document['transintent'], _pc.document['refspwmap'], _pc.document['reffile'], _pc.document['phaseupsolint'], _pc.document['solint'], _pc.document['minsnr'], _pc.document['refant'], _pc.document['hm_resolvedcals'], _pc.document['antenna'], _pc.document['peak_fraction'], _pc.document['pipelinemode'], _pc.document['dryrun'], _pc.document['acceptresults'] ) )
hifa_gfluxscale = _hifa_gfluxscale( )