casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables
gaincal_pg.py
Go to the documentation of this file.
00001 #
00002 # This file was generated using xslt from its XML file
00003 #
00004 # Copyright 2008, Associated Universities Inc., Washington DC
00005 #
00006 import sys
00007 import os
00008 from casac import *
00009 import string
00010 import time
00011 import inspect
00012 import gc
00013 import numpy
00014 from odict import odict
00015 from task_gaincal import gaincal
00016 from task_gaincal import casalog
00017 
00018 class gaincal_pg_:
00019     __name__ = "gaincal"
00020 
00021     def __init__(self) :
00022        self.__bases__ = (gaincal_pg_,)
00023        self.__doc__ = self.__call__.__doc__
00024 
00025 
00026     def __call__(self, vis=None, caltable=None, field=None, spw=None, intent=None, selectdata=None, timerange=None, uvrange=None, antenna=None, scan=None, observation=None, msselect=None, solint=None, combine=None, preavg=None, refant=None, minblperant=None, minsnr=None, solnorm=None, gaintype=None, smodel=None, calmode=None, append=None, splinetime=None, npointaver=None, phasewrap=None, gaintable=None, gainfield=None, interp=None, spwmap=None, gaincurve=None, opacity=None, parang=None, async=None):
00027 
00028         """Determine temporal gains from calibrator observations
00029 
00030       The complex gains for each antenna/spwid are determined from the
00031       data column (raw data) divided by the model column.  The gains can
00032       be obtained for a specified solution interval, spw combination and
00033       field combination.  The GSPLINE spline (smooth) option is still under
00034       development.
00035 
00036       Previous calibrations (egs, bandpass, opacity, parallactic angle) can
00037       be applied on the fly.  At present with dual-polarized data, both
00038       polarizations must be unflagged for any solution to be obtained.
00039 
00040       Keyword arguments:
00041       vis -- Name of input visibility file
00042               default: none; example: vis='ngc5921.ms'
00043       caltable -- Name of output gain calibration table
00044               default: none; example: caltable='ngc5921.gcal'
00045 
00046       --- Data Selection (see help par.selectdata for more detailed information)
00047 
00048       field -- Select field using field id(s) or field name(s).
00049                  ['go listobs' to obtain the list id's or names]
00050               default: ''=all fields
00051               If field string is a non-negative integer, it is assumed a
00052                 field index,  otherwise, it is assumed a field name
00053               field='0~2'; field ids 0,1,2
00054               field='0,4,5~7'; field ids 0,4,5,6,7
00055               field='3C286,3C295'; field named 3C286 and 3C295
00056               field = '3,4C*'; field id 3, all names starting with 4C
00057           DON'T FORGET TO INCLUDE THE FLUX DENSITY CALIBRATOR IF YOU HAVE ONE
00058       spw -- Select spectral window/channels 
00059                type 'help par.selection' for more examples.
00060              spw='0~2,4'; spectral windows 0,1,2,4 (all channels)
00061              spw='<2';  spectral windows less than 2 (i.e. 0,1)
00062              spw='0:5~61'; spw 0, channels 5 to 61, INCLUSIVE
00063              spw='*:5~61'; all spw with channels 5 to 61
00064              spw='0,10,3:3~45'; spw 0,10 all channels, spw 3, channels 3 to 45.
00065              spw='0~2:2~6'; spw 0,1,2 with channels 2 through 6 in each.
00066              spw='0:0~10;15~60'; spectral window 0 with channels 0-10,15-60
00067                        NOTE ';' to separate channel selections
00068              spw='0:0~10^2,1:20~30^5'; spw 0, channels 0,2,4,6,8,10,
00069                    spw 1, channels 20,25,30
00070       intent -- Select observing intent
00071                 default: ''  (no selection by intent)
00072                 intent='*BANDPASS*'  (selects data labelled with
00073                                       BANDPASS intent)
00074       selectdata -- Other data selection parameters
00075               default: False 
00076 
00077               Must set selectdata=True to use the following selections:
00078 
00079       timerange  -- Select data based on time range:
00080               default = '' (all); examples,
00081               timerange = 'YYYY/MM/DD/hh:mm:ss~YYYY/MM/DD/hh:mm:ss'
00082               Note: if YYYY/MM/DD is missing date defaults to first day in data set
00083               timerange='09:14:0~09:54:0' picks 40 min on first day
00084               timerange= '25:00:00~27:30:00' picks 1 hr to 3 hr 30min on NEXT day
00085               timerange='09:44:00' pick data within one integration of time
00086               timerange='>10:24:00' data after this time
00087       uvrange -- Select data within uvrange (default units meters)
00088               default: '' (all); example:
00089               uvrange='0~1000klambda'; uvrange from 0-1000 kilo-lambda
00090               uvrange='>4klambda';uvranges greater than 4 kilo lambda
00091       antenna -- Select data based on antenna/baseline
00092               default: '' (all)
00093               If antenna string is a non-negative integer, it is assumed an
00094                 antenna index, otherwise, it is assumed as an antenna name
00095               antenna='5&6'; baseline between antenna index 5 and index 6.
00096               antenna='VA05&VA06'; baseline between VLA antenna 5 and 6.
00097               antenna='5&6;7&8'; baselines with indices 5-6 and 7-8
00098               antenna='5'; all baselines with antenna index 5
00099               antenna='05'; all baselines with antenna number 05 (VLA old name)
00100               antenna='5,6,10'; all baselines with antennas 5,6,10 index numbers
00101       scan -- Scan number range.
00102               Check 'go listobs' to insure the scan numbers are in order.
00103       observation -- Observation ID(s).
00104                      default: '' = all
00105                      example: '0~2,4'
00106       msselect -- Optional complex data selection (ignore for now)
00107 
00108       --- Solution parameters
00109       gaintype -- Type of gain solution (G, T, or GSPLINE)
00110               default: 'G'; example: gaintype='GSPLINE'
00111               'G' means determine gains for each polarization and sp_wid
00112               'T' obtains one solution for both polarizations;  Hence. their
00113                 phase offset must be first removed using a prior G.
00114               'GSPLINE' makes a spline fit to the calibrator data.  It is
00115                    useful for noisy data and fits a smooth curve through the
00116                    calibrated amplitude and phase.  However,
00117                    at present GSPLINE is somewhat experimental.  Use with
00118                    caution and check solutions.
00119               'K' solves for simple antenna-based single-band delays
00120                    via FFTs of the spectra on baselines to the
00121                    reference antenna.  (This is not global fringe-fitting.)
00122               'KCROSS' solves for a global cross-hand
00123                    delay.  Use parang=T and apply prior gain and
00124                    bandpass solutions.
00125       smodel -- Point source Stokes parameters for source model (experimental)
00126               default: [] (use MODEL_DATA column)
00127               example: [1,0,0,0] (I=1, unpolarized)
00128       calmode -- Type of solution
00129               default: 'ap' (amp and phase); example: calmode='p'
00130               Options: 'p','a','ap'
00131       solint --  Solution interval (units optional) 
00132               default: 'inf' (~infinite, up to boundaries controlled by combine); 
00133               Options: 'inf' (~infinite), 
00134                        'int' (per integration)
00135                        any float or integer value with or without units
00136               examples: solint='1min'; solint='60s'; solint=60 --> 1 minute
00137                         solint='0s'; solint=0; solint='int' --> per integration
00138                         solint-'-1s'; solint='inf' --> ~infinite, up to boundaries
00139                         interacts with combine
00140       combine -- Data axes to combine for solving
00141               default: '' --> solutions will break at scan, field, and spw
00142                       boundaries
00143               Options: '','scan','spw',field', or any comma-separated combination
00144               example: combine='scan,spw'  --> extend solutions over scan boundaries
00145                        (up to the solint), and combine spws for solving
00146       refant -- Reference antenna name(s); a prioritized list may be specified
00147               default: '' => no refant applied
00148               example: refant='4' (antenna with index 4)
00149                        refant='VA04' (VLA antenna #4)
00150                        refant='EA02,EA23,EA13' (EVLA antenna EA02, use
00151                                 EA23 and EA13 as alternates if/when EA02
00152                                 drops out)
00153               Use taskname=listobs for antenna listing
00154       minblperant --  Minimum number of baselines required per antenna for each solve
00155               default = 4
00156               Antennas with fewer baaselines are excluded from solutions.
00157               example: minblperant=10  => Antennas participating on 10 or more 
00158                        baselines are included in the solve
00159               minblperant = 1 will solve for all baseline pairs, even if only
00160                    one is present in the data set.  Unless closure errors are
00161                    expected, use taskname=gaincal rather than taskname=blcal to
00162                    obtain more options in data analysis.
00163       minsnr -- Reject solutions below this SNR
00164               default: 3.0 
00165       solnorm -- Normalize average solution amps to 1.0 after solution (G, T only)
00166               default: False (no normalization)
00167       append -- Append solutions to the (existing) table
00168               default: False; overwrite existing table or make new table
00169       splinetime -- Spline timescale (sec); used for gaintype='GSPLINE'
00170               default: 3600 (1 hour); example: splinetime=1000
00171               Typical splinetime should cover about 3 to 5 calibrator scans.
00172       npointaver -- Tune phase-unwrapping algorithm for gaintype='GSPLINE'
00173               default: 3; Keep at this value
00174       phasewrap -- Wrap the phase for changes larger than this amoun (degrees)
00175               default: 180; Keep at this value
00176 
00177       --- Other calibrations to apply on the fly before determining gaincal solution
00178 
00179       gaintable -- Gain calibration table(s) to apply 
00180                default: '' (none);
00181                examples: gaintable='ngc5921.gcal'
00182                          gaintable=['ngc5921.ampcal','ngc5921.phcal']
00183       gainfield -- Select a subset of calibrators from gaintable(s) to apply
00184                default:'' ==> all sources in table;
00185                'nearest' ==> nearest (on sky) available field in table
00186                otherwise, same syntax as field
00187                example: gainfield='0~2,5' means use fields 0,1,2,5 from gaintable
00188                         gainfield=['0~3','4~6'] means use field 0 through 3
00189                           from first gain file, field 4 through 6 for second.
00190       interp -- Interpolation type (in time[,freq]) to use for each gaintable.
00191                 When frequency interpolation is relevant (B, Df, Xf),
00192                 separate time-dependent and freq-dependent interp
00193                 types with a comma (freq _after_ the comma).                
00194                 Specifications for frequency are ignored when the
00195                 calibration table has no channel-dependence.
00196                 Time-dependent interp options ending in 'PD' enable a
00197                 "phase delay" correction per spw for non-channel-dependent
00198                 calibration types.
00199                 default: '' --> 'linear,linear' for all gaintable(s)
00200                 example: interp='nearest'   (in time, freq-dep will be
00201                                              linear, if relevant)
00202                          interp='linear,cubic'  (linear in time, cubic
00203                                                  in freq)
00204                          interp=',spline'  (spline in freq; linear in
00205                                             time by default)
00206                          interp=['nearest,spline','linear']  (for multiple gaintables)
00207                 Options: Time: 'nearest', 'linear'
00208                          Freq: 'nearest', 'linear', 'cubic', 'spline'
00209       spwmap -- Spectral windows combinations to form for gaintable(s)
00210                 default: [] (apply solutions from each spw to that spw only)
00211                 Example:  spwmap=[0,0,1,1] means apply the caltable solutions
00212                           from spw = 0 to the spw 0,1 and spw 1 to spw 2,3.
00213                           spwmap=[[0,0,1,1],[0,1,0,1]]
00214       gaincurve -- Apply internal VLA antenna gain curve correction (True/False)
00215                default: False;
00216                Use gaincurve=True ONLY for VLA data
00217       opacity -- Opacity correction to apply (nepers), per spw
00218                default: [] (no opacity correction for any spw)
00219                examples:
00220                    A global value for all spws:
00221                      opacity=0.051
00222                    Different values for spws 0,1,2:
00223                      opacity=[0.051, 0.055, 0.057]
00224                    (if more than 3 spws, spw 3 and higher will
00225                     be assigned the last specified value, or 0.057)
00226                Typical VLA values are: 5 GHz - 0.013, 8 GHz - 0.013
00227                15 GHz - 0.016, 23 GHz - 0.051, 43 GHz - 0.07
00228       parang -- If True, apply the parallactic angle correction (required
00229                for polarization calibration)
00230                default: False
00231       preavg -- Pre-averaging interval (sec)
00232               default=-1 (none).
00233                Rarely needed.  Will average data over periods shorter than
00234                  the solution interval first.
00235       async --  Run asynchronously
00236               default = False; do not run asychronously
00237 
00238         """
00239         a=inspect.stack()
00240         stacklevel=0
00241         for k in range(len(a)):
00242           if (string.find(a[k][1], 'ipython console') > 0) or (string.find(a[k][1], '<string>') >= 0):
00243                 stacklevel=k
00244                 break
00245         myf=sys._getframe(stacklevel).f_globals
00246         myf['__last_task'] = 'gaincal'
00247         myf['taskname'] = 'gaincal'
00248         ###
00249         myf['update_params'](func=myf['taskname'],printtext=False)
00250         ###
00251         ###
00252         #Handle globals or user over-ride of arguments
00253         #
00254         function_signature_defaults=dict(zip(self.__call__.func_code.co_varnames,self.__call__.func_defaults))
00255         useLocalDefaults = False
00256 
00257         for item in function_signature_defaults.iteritems():
00258                 key,val = item
00259                 keyVal = eval(key)
00260                 if (keyVal == None):
00261                         #user hasn't set it - use global/default
00262                         pass
00263                 else:
00264                         #user has set it - use over-ride
00265                         if (key != 'self') :
00266                            useLocalDefaults = True
00267                         #myf[key]=keyVal
00268 
00269         myparams = {}
00270         if useLocalDefaults :
00271            for item in function_signature_defaults.iteritems():
00272                key,val = item
00273                keyVal = eval(key)
00274                exec('myparams[key] = keyVal')
00275                if (keyVal == None):
00276                    exec('myparams[key] = '+ key + ' = self.itsdefault(key)')
00277                    keyVal = eval(key)
00278                    if(type(keyVal) == dict) :
00279                       exec('myparams[key] = ' + key + ' = keyVal[len(keyVal)-1][\'value\']')
00280 
00281         else :
00282             uselessvariable = None 
00283             myparams['vis'] = vis = myf['vis']
00284             myparams['caltable'] = caltable = myf['caltable']
00285             myparams['field'] = field = myf['field']
00286             myparams['spw'] = spw = myf['spw']
00287             myparams['intent'] = intent = myf['intent']
00288             myparams['selectdata'] = selectdata = myf['selectdata']
00289             myparams['timerange'] = timerange = myf['timerange']
00290             myparams['uvrange'] = uvrange = myf['uvrange']
00291             myparams['antenna'] = antenna = myf['antenna']
00292             myparams['scan'] = scan = myf['scan']
00293             myparams['observation'] = observation = myf['observation']
00294             myparams['msselect'] = msselect = myf['msselect']
00295             myparams['solint'] = solint = myf['solint']
00296             myparams['combine'] = combine = myf['combine']
00297             myparams['preavg'] = preavg = myf['preavg']
00298             myparams['refant'] = refant = myf['refant']
00299             myparams['minblperant'] = minblperant = myf['minblperant']
00300             myparams['minsnr'] = minsnr = myf['minsnr']
00301             myparams['solnorm'] = solnorm = myf['solnorm']
00302             myparams['gaintype'] = gaintype = myf['gaintype']
00303             myparams['smodel'] = smodel = myf['smodel']
00304             myparams['calmode'] = calmode = myf['calmode']
00305             myparams['append'] = append = myf['append']
00306             myparams['splinetime'] = splinetime = myf['splinetime']
00307             myparams['npointaver'] = npointaver = myf['npointaver']
00308             myparams['phasewrap'] = phasewrap = myf['phasewrap']
00309             myparams['gaintable'] = gaintable = myf['gaintable']
00310             myparams['gainfield'] = gainfield = myf['gainfield']
00311             myparams['interp'] = interp = myf['interp']
00312             myparams['spwmap'] = spwmap = myf['spwmap']
00313             myparams['gaincurve'] = gaincurve = myf['gaincurve']
00314             myparams['opacity'] = opacity = myf['opacity']
00315             myparams['parang'] = parang = myf['parang']
00316 
00317         if type(smodel)==float: smodel=[smodel]
00318         if type(gaintable)==str: gaintable=[gaintable]
00319         if type(gainfield)==str: gainfield=[gainfield]
00320         if type(interp)==str: interp=[interp]
00321         if type(spwmap)==int: spwmap=[spwmap]
00322         if type(opacity)==float: opacity=[opacity]
00323 
00324         result = None
00325 
00326 #
00327 #    The following is work around to avoid a bug with current python translation
00328 #
00329         mytmp = {}
00330 
00331         mytmp['vis'] = vis
00332         mytmp['caltable'] = caltable
00333         mytmp['field'] = field
00334         mytmp['spw'] = spw
00335         mytmp['intent'] = intent
00336         mytmp['selectdata'] = selectdata
00337         mytmp['timerange'] = timerange
00338         mytmp['uvrange'] = uvrange
00339         mytmp['antenna'] = antenna
00340         mytmp['scan'] = scan
00341         mytmp['observation'] = observation
00342         mytmp['msselect'] = msselect
00343         mytmp['solint'] = solint
00344         mytmp['combine'] = combine
00345         mytmp['preavg'] = preavg
00346         mytmp['refant'] = refant
00347         mytmp['minblperant'] = minblperant
00348         mytmp['minsnr'] = minsnr
00349         mytmp['solnorm'] = solnorm
00350         mytmp['gaintype'] = gaintype
00351         mytmp['smodel'] = smodel
00352         mytmp['calmode'] = calmode
00353         mytmp['append'] = append
00354         mytmp['splinetime'] = splinetime
00355         mytmp['npointaver'] = npointaver
00356         mytmp['phasewrap'] = phasewrap
00357         mytmp['gaintable'] = gaintable
00358         mytmp['gainfield'] = gainfield
00359         mytmp['interp'] = interp
00360         mytmp['spwmap'] = spwmap
00361         mytmp['gaincurve'] = gaincurve
00362         mytmp['opacity'] = opacity
00363         mytmp['parang'] = parang
00364         pathname='file:///'+os.environ.get('CASAPATH').split()[0]+'/share/xml/'
00365         trec = casac.utils().torecord(pathname+'gaincal.xml')
00366 
00367         casalog.origin('gaincal')
00368         if not trec.has_key('gaincal') or not casac.utils().verify(mytmp, trec['gaincal']) :
00369             return False
00370 
00371 
00372         try :
00373           casalog.post('')
00374           casalog.post('##########################################')
00375           casalog.post('##### Begin Task: gaincal           #####')
00376           casalog.post('')
00377           result = gaincal(vis, caltable, field, spw, intent, selectdata, timerange, uvrange, antenna, scan, observation, msselect, solint, combine, preavg, refant, minblperant, minsnr, solnorm, gaintype, smodel, calmode, append, splinetime, npointaver, phasewrap, gaintable, gainfield, interp, spwmap, gaincurve, opacity, parang)
00378           casalog.post('')
00379           casalog.post('##### End Task: gaincal           #####')
00380           casalog.post('##########################################')
00381 
00382 
00383 # saveinputs for individule engine has no use
00384 # saveinputs should alos be removed from casa_in_py.py
00385 #
00386 #
00387 #          saveinputs = myf['saveinputs']
00388 #          saveinputs('gaincal', 'gaincal.last', myparams)
00389 #
00390 #
00391         except Exception, instance:
00392           #print '**** Error **** ',instance
00393           pass
00394 
00395         gc.collect()
00396         return result
00397 #
00398 #
00399 ##
00400 #    def paramgui(self, useGlobals=True):
00401 #        """
00402 #        Opens a parameter GUI for this task.  If useGlobals is true, then any relevant global parameter settings are used.
00403 #        """
00404 #        import paramgui
00405 #
00406 #        a=inspect.stack()
00407 #        stacklevel=0
00408 #        for k in range(len(a)):
00409 #          if (string.find(a[k][1], 'ipython console') > 0) or (string.find(a[k][1], '<string>') >= 0):
00410 #            stacklevel=k
00411 #            break
00412 #        myf = sys._getframe(stacklevel).f_globals
00413 #
00414 #        if useGlobals:
00415 #            paramgui.setGlobals(myf)
00416 #        else:
00417 #            paramgui.setGlobals({})
00418 #
00419 #        paramgui.runTask('gaincal', myf['_ip'])
00420 #        paramgui.setGlobals({})
00421 #
00422 #
00423 #
00424 #
00425     def defaults(self, param=None):
00426         a=inspect.stack()
00427         stacklevel=0
00428         for k in range(len(a)):
00429           if (string.find(a[k][1], 'ipython console') > 0) or (string.find(a[k][1], '<string>') >= 0):
00430                 stacklevel=k
00431                 break
00432         myf=sys._getframe(stacklevel).f_globals
00433         a = odict()
00434         a['vis']  = ''
00435         a['caltable']  = ''
00436         a['field']  = ''
00437         a['spw']  = ''
00438         a['intent']  = ''
00439         a['selectdata']  = True
00440         a['solint']  = 'inf'
00441         a['combine']  = ''
00442         a['preavg']  = -1.0
00443         a['refant']  = ''
00444         a['minblperant']  = 4
00445         a['minsnr']  = 3.0
00446         a['solnorm']  = False
00447         a['gaintype']  = 'G'
00448         a['smodel']  = []
00449         a['calmode']  = 'ap'
00450         a['append']  = False
00451         a['gaintable']  = ['']
00452         a['gainfield']  = ['']
00453         a['interp']  = ['']
00454         a['spwmap']  = []
00455         a['gaincurve']  = False
00456         a['opacity']  = []
00457         a['parang']  = False
00458 
00459         a['async']=False
00460         a['selectdata'] = {
00461                     0:{'value':False}, 
00462                     1:odict([{'value':True}, {'timerange':''}, {'uvrange':''}, {'antenna':''}, {'scan':''}, {'observation':''}, {'msselect':''}])}
00463         a['gaintype'] = {
00464                     0:{'value':'G'}, 
00465                     1:{'value':'T'}, 
00466                     2:{'value':'K'}, 
00467                     3:{'value':'KCROSS'}, 
00468                     4:{'value':'XY+QU'}, 
00469                     5:odict([{'value':'GSPLINE'}, {'splinetime':3600.0}, {'npointaver':3}, {'phasewrap':180.0}])}
00470 
00471 ### This function sets the default values but also will return the list of
00472 ### parameters or the default value of a given parameter
00473         if(param == None):
00474                 myf['__set_default_parameters'](a)
00475         elif(param == 'paramkeys'):
00476                 return a.keys()
00477         else:
00478                 if(a.has_key(param)):
00479                    #if(type(a[param]) == dict) :
00480                    #   return a[param][len(a[param])-1]['value']
00481                    #else :
00482                       return a[param]
00483 
00484 
00485 #
00486 #
00487     def check_params(self, param=None, value=None):
00488       a=inspect.stack() 
00489       stacklevel=0
00490       for k in range(len(a)):
00491         if (string.find(a[k][1], 'ipython console') > 0) or (string.find(a[k][1], '<string>') >= 0):
00492             stacklevel=k
00493             break
00494       myf=sys._getframe(stacklevel).f_globals
00495 
00496 #      print 'param:', param, 'value:', value
00497       try :
00498          if str(type(value)) != "<type 'instance'>" :
00499             value0 = value
00500             value = myf['cu'].expandparam(param, value)
00501             matchtype = False
00502             if(type(value) == numpy.ndarray):
00503                if(type(value) == type(value0)):
00504                   myf[param] = value.tolist()
00505                else:
00506                   #print 'value:', value, 'value0:', value0
00507                   #print 'type(value):', type(value), 'type(value0):', type(value0)
00508                   myf[param] = value0
00509                   if type(value0) != list :
00510                      matchtype = True
00511             else :
00512                myf[param] = value
00513             value = myf['cu'].verifyparam({param:value})
00514             if matchtype:
00515                value = False
00516       except Exception, instance:
00517          #ignore the exception and just return it unchecked
00518          myf[param] = value
00519       return value
00520 
00521 #
00522 #
00523     def description(self, key='gaincal', subkey=None):
00524         desc={'gaincal': 'Determine temporal gains from calibrator observations',
00525                'vis': 'Name of input visibility file',
00526                'caltable': 'Name of output gain calibration table',
00527                'field': 'Select field using field id(s) or field name(s)',
00528                'spw': 'Select spectral window/channels',
00529                'intent': 'Select observing intent',
00530                'selectdata': 'Other data selection parameters',
00531                'timerange': 'Select data based on time range',
00532                'uvrange': 'Select data within uvrange (default units meters)',
00533                'antenna': 'Select data based on antenna/baseline',
00534                'scan': 'Scan number range',
00535                'observation': 'Select by observation ID(s)',
00536                'msselect': 'Optional complex data selection (ignore for now)',
00537                'solint': 'Solution interval: egs. \'inf\', \'60s\' (see help)',
00538                'combine': 'Data axes which to combine for solve (scan, spw, and/or field)',
00539                'preavg': 'Pre-averaging interval (sec) (rarely needed)',
00540                'refant': 'Reference antenna name(s)',
00541                'minblperant': 'Minimum baselines _per antenna_ required for solve',
00542                'minsnr': 'Reject solutions below this SNR',
00543                'solnorm': 'Normalize average solution amplitudes to 1.0 (G, T only)',
00544                'gaintype': 'Type of gain solution (G,T,GSPLINE,K,KCROSS)',
00545                'smodel': 'Point source Stokes parameters for source model.',
00546                'calmode': 'Type of solution: (\'ap\', \'p\', \'a\')',
00547                'append': 'Append solutions to the (existing) table',
00548                'splinetime': 'Spline timescale(sec); All spw\'s are first averaged.',
00549                'npointaver': 'The phase-unwrapping algorithm',
00550                'phasewrap': 'Wrap the phase for jumps greater than this value (degrees)',
00551                'gaintable': 'Gain calibration table(s) to apply on the fly',
00552                'gainfield': 'Select a subset of calibrators from gaintable(s)',
00553                'interp': 'Temporal interpolation for each gaintable (''=linear)',
00554                'spwmap': 'Spectral windows combinations to form for gaintables(s)',
00555                'gaincurve': 'Apply internal VLA antenna gain curve correction',
00556                'opacity': 'Opacity correction to apply (nepers), per spw',
00557                'parang': 'Apply parallactic angle correction on the fly',
00558 
00559                'async': 'If true the taskname must be started using gaincal(...)'
00560               }
00561 
00562 #
00563 # Set subfields defaults if needed
00564 #
00565 
00566         if(desc.has_key(key)) :
00567            return desc[key]
00568 
00569     def itsdefault(self, paramname) :
00570         a = {}
00571         a['vis']  = ''
00572         a['caltable']  = ''
00573         a['field']  = ''
00574         a['spw']  = ''
00575         a['intent']  = ''
00576         a['selectdata']  = True
00577         a['timerange']  = ''
00578         a['uvrange']  = ''
00579         a['antenna']  = ''
00580         a['scan']  = ''
00581         a['observation']  = ''
00582         a['msselect']  = ''
00583         a['solint']  = 'inf'
00584         a['combine']  = ''
00585         a['preavg']  = -1.0
00586         a['refant']  = ''
00587         a['minblperant']  = 4
00588         a['minsnr']  = 3.0
00589         a['solnorm']  = False
00590         a['gaintype']  = 'G'
00591         a['smodel']  = []
00592         a['calmode']  = 'ap'
00593         a['append']  = False
00594         a['splinetime']  = 3600.0
00595         a['npointaver']  = 3
00596         a['phasewrap']  = 180.0
00597         a['gaintable']  = ['']
00598         a['gainfield']  = ['']
00599         a['interp']  = ['']
00600         a['spwmap']  = []
00601         a['gaincurve']  = False
00602         a['opacity']  = []
00603         a['parang']  = False
00604 
00605         if a.has_key(paramname) :
00606               return a[paramname]
00607 gaincal_pg = gaincal_pg_()