casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables
polcal_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_polcal import polcal
00016 from task_polcal import casalog
00017 
00018 class polcal_pg_:
00019     __name__ = "polcal"
00020 
00021     def __init__(self) :
00022        self.__bases__ = (polcal_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, poltype=None, smodel=None, append=None, gaintable=None, gainfield=None, interp=None, spwmap=None, gaincurve=None, opacity=None, async=None):
00027 
00028         """Determine instrumental polarization calibrations
00029 
00030       The instrumental polarization factors (D-terms), the calibrator polarization,
00031       and the R-L polarization angle can be determined using polcal.  The solutions
00032       can be obtained for each antenna/spwid and even individual channels, if desired.
00033       Previous calibrations of the total intensity data should be applied on the fly
00034       when running polcal, since polcal uses the 'data' column, not the 'corrected'
00035       column.
00036 
00037       After calibrating the gain, bandpass, and (if relevant, for channelized data)
00038       cross-hand delay, the simplest way to calibrate the polarization data is:
00039 
00040         a) Run polcal with poltype = 'D+QU' on the main 'calibrator' source.  The D terms
00041            and polarization (QU) of the calibrator will be determined.  Relatively good
00042            parallactic angle coverage is needed.
00043 
00044         b) If there is little parallactic angle coverage, place the known polarization of
00045            the main calibrator (or 0) using setjy with the appropriate fluxdensity.  Then
00046            run polcal with poltype = 'D'.  Run plotcal with xaxis = 'real'; yaxis ='imag'
00047            to view solutions.  It is best to use an unpolarized calibrator in this 
00048            instance; large systematic offsets from zero indicate significant source  
00049            polarization that will bias the polarization calibration.  A mechanism 
00050            to constrain this bias will be made available in the near future. 
00051 
00052         c) To determine R-L polarization angle, use setjy to put the fluxdensity of the
00053            polarization calibrator [I,Q,U,0.0] in the model column.  For resolved sources
00054            put in values associated with an appropriate u-v range.  Polarized models are
00055            not yet available for the major polarization standard sources, so very
00056            resolved polarized sources should not be used.
00057 
00058         d) Run polcal with poltype = 'X' and include polarization standard.  Make sure to
00059            include all previous calibrations, especially the D results.  Run plotxy with
00060            correlation = 'RL LR' and make sure polarization angles are as expected.
00061 
00062         e) Run applycal with all calibration table, include the D and X tables.  Make sure
00063            that parang = T
00064 
00065          NOTE: For very high dynamic range, use poltype='Df' or 'Df+QU' to determine 
00066                D terms for each channel.  Similarly, poltype='Xf' can
00067                be used to determine a channel-dependent R-L phase
00068                "bandpass".
00069          NOTE: Rather than use setjy in b and c above, the new smodel
00070                parameter may be used in polcal to specify a simple
00071                point source Stokes model.  
00072 
00073       Keyword arguments:
00074       vis -- Name of input visibility file
00075               default: none; example: vis='ngc5921.ms'
00076       caltable -- Name of output gain calibration table
00077               default: none; example: caltable='ngc5921.dcal'
00078 
00079       --- Data Selection (see help par.selectdata for more detailed information)
00080 
00081       field -- Select field using field id(s) or field name(s).
00082                  [run listobs to obtain the list id's or names]
00083               default: ''=all fields.
00084                   Most likely, the main calibrator source should be picked.
00085               If field string is a non-negative integer, it is assumed a field index
00086                 otherwise, it is assumed a field name
00087               field='0~2'; field ids 0,1,2
00088               field='0,4,5~7'; field ids 0,4,5,6,7
00089               field='3C286,3C295'; field named 3C286 adn 3C295
00090               field = '3,4C*'; field id 3, all names starting with 4C
00091       spw -- Select spectral window/channels 
00092                type 'help par.selection' for more examples.
00093              spw='0~2,4'; spectral windows 0,1,2,4 (all channels)
00094              spw='<2';  spectral windows less than 2 (i.e. 0,1)
00095              spw='0:5~61'; spw 0, channels 5 to 61, INCLUSIVE
00096              spw='*:5~61'; all spw with channels 5 to 62
00097              spw='0,10,3:3~45'; spw 0,10 all channels, spw 3, channels 3 to 45.
00098              spw='0~2:2~6'; spw 0,1,2 with channels 2 through 6 in each.
00099              spw='0:0~10;15~60'; spectral window 0 with channels 0-10,15-60
00100                        NOTE ';' to separate channel selections
00101              spw='0:0~10^2,1:20~30^5'; spw 0, channels 0,2,4,6,8,10,
00102                    spw 1, channels 20,25,30
00103       intent -- Select observing intent
00104                 default: ''  (no selection by intent)
00105                 intent='*BANDPASS*'  (selects data labelled with
00106                                       BANDPASS intent)
00107       selectdata -- Other data selection parameters
00108               default: True
00109       timerange  -- Select data based on time range:
00110               default = '' (all); examples,
00111               timerange = 'YYYY/MM/DD/hh:mm:ss~YYYY/MM/DD/hh:mm:ss'
00112               Note: if YYYY/MM/DD is missing dat defaults to first day in data set
00113               timerange='09:14:0~09:54:0' picks 40 min on first day
00114               timerange= '25:00:00~27:30:00' picks 1 hr to 3 hr 30min on next day
00115               timerange='09:44:00' data within one integration of time
00116               timerange='>10:24:00' data after this time
00117       uvrange -- Select data within uvrange (default units meters)
00118               default: '' (all); example:
00119               uvrange='0~1000'; uvrange from 0-1000 kilo-lamgda
00120               uvrange='>4';uvranges greater than 4 kilo-lambda
00121       antenna -- Select data based on antenna/baseline
00122               default: '' (all)
00123               If antenna string is a non-negative integer, it is assumed an antenna index
00124                 otherwise, it is assumed as an antenna name
00125               antenna='5&6'; baseline between antenna index 5 and index 6.
00126               antenna='VA05&VA06'; baseline between VLA antenna 5 and 6.
00127               antenna='5&6;7&8'; baseline 5-6 and 7-8
00128               antenna='5'; all baselines with antenna index 5
00129               antenna='05'; all baselines with antenna name 05, i.e. VLA ant 5
00130               antenna='5,6,10'; all baselines with antennas 5, 6 and 10
00131       scan -- Scan number range
00132       observation -- Observation ID(s).
00133                      default: '' = all
00134                      example: '0~2,4'
00135       msselect -- Optional complex data selection (ignore for now)
00136 
00137       --- Solution parameters
00138       poltype -- Type of instrumental polarization solution
00139               'D+QU' (or 'Df+QU')  solve also for apparent source polarization (channelized D)
00140                  Need relatively good parallactic angle coverage for this
00141               'D' (or 'Df') solve only for instrumental polarization (channelized).  The
00142                  I, Q, U flux density of the source can be placed in the model column using
00143                  setjy.  Use for poor parallactic angle coverage.
00144               'X' (or 'Xf') = solve only for position angle correction (channelized).  
00145                  The source must have its I, Q, U flux density in the model column 
00146                  or specified in smodel.  If the source is resolved, use a limited 
00147                  uvrange that is appropriate.
00148               'D+X' (or 'Df+X') = solve also for position angle offset (channelized D) as
00149                  well as the D-term.  Not normally done.
00150               default: 'D+QU'
00151               The solution used the traditional linear approximation.  Non-linearized options
00152                   will be avaible soon.
00153       smodel -- Point source Stokes parameters for source model (experimental)
00154               default: [] (use MODEL_DATA column)
00155               examples: [1,0,0,0] (I=1, unpolarized)
00156                         [5.2,0.2,0.3,0.0] (I=5.2, Q=0.2, U=0.3, V=0.0)
00157       solint --  Solution interval (units optional) 
00158               default: 'inf' (~infinite, up to boundaries controlled by combine); 
00159               Options: 'inf' (~infinite), 'int' (per integration), any float
00160                        or integer value with or without units
00161               examples: solint='1min'; solint='60s', solint=60 --> 1 minute
00162                         solint='0s'; solint=0; solint='int' --> per integration
00163                         solint-'-1s'; solint='inf' --> ~infinite, up to boundaries
00164                         enforced by combine
00165       combine -- Data axes to combine for solving
00166               default: 'scan' --> solutions will break at field and spw boundaries,
00167                         but may extend over multiple scans (per field and spw) up
00168                         to solint.
00169               Options: '','scan','spw',field', or any comma-separated combination
00170               example: combine='scan,spw'  --> extend solutions over scan boundaries
00171                        (up to the solint), and combine spws for solving
00172       preavg -- Pre-averaging interval (sec)
00173               default=300
00174               Interval to apply parallactic angle.
00175       refant -- Reference antenna name
00176               default: '' => refant = '0'
00177               example: refant='13' (antenna with index 13)
00178                        refant='VA04' (VLA antenna #4)
00179                        refant='EA02,EA23,EA13' (EVLA antenna EA02, use
00180                                 EA23 and EA13 as alternates if/when EA02
00181                                 drops out)
00182               Use 'go listobs' for antenna listing.
00183               USE SAME REFERENCE ANTENNA AS USED FOR I CALIBRATION.
00184       minblperant -- Minimum number of baselines required per antenna for each solve
00185                    Antennas with fewer baaselines are excluded from solutions. Amplitude
00186                    solutions with fewer than 4 baselines, and phase solutions with fewer 
00187                    than 3 baselines are only trivially constrained, and are no better
00188                    than baseline-based solutions.
00189                    default: 4
00190                    example: minblperant=10  => Antennas participating on 10 or more 
00191                             baselines are included in the solve
00192       minsnr -- Reject solutions below this SNR
00193               default: 3.0
00194       append -- Append solutions to the (existing) table
00195               default: False; overwrite existing table or make new table
00196 
00197       --- Other calibrations to apply on the fly before determining gaincal solution
00198 
00199       gaintable -- Gain calibration table(s) to apply 
00200                default: '' (none);  BUT I CALIBRATION TABLES SHOULD GENERALLY BE INCLUDED
00201                examples: gaintable='ngc5921.gcal'
00202                          gaintable=['ngc5921.ampcal','ngc5921.phcal']
00203       gainfield -- Select a subset of calibrators from gaintable(s)
00204                default:'' ==> all sources in table;
00205                'nearest' ==> nearest (on sky) available field in table
00206                otherwise, same syntax as field
00207                example: gainfield='0~3'
00208                         gainfield=['0~3','4~6'] means use field 0 through 3
00209                           from first gain file, field 4 through 6 for second.
00210       interp -- Interpolation type (in time[,freq]) to use for each gaintable.
00211                 When frequency interpolation is relevant (B, Df, Xf),
00212                 separate time-dependent and freq-dependent interp
00213                 types with a comma (freq _after_ the comma).                
00214                 Specifications for frequency are ignored when the
00215                 calibration table has no channel-dependence.
00216                 Time-dependent interp options ending in 'PD' enable a
00217                 "phase delay" correction per spw for non-channel-dependent
00218                 calibration types.
00219                 default: '' --> 'linear,linear' for all gaintable(s)
00220                 example: interp='nearest'   (in time, freq-dep will be
00221                                              linear, if relevant)
00222                          interp='linear,cubic'  (linear in time, cubic
00223                                                  in freq)
00224                          interp=',spline'  (spline in freq; linear in
00225                                             time by default)
00226                          interp=['nearest,spline','linear']  (for multiple gaintables)
00227                 Options: Time: 'nearest', 'linear'
00228                          Freq: 'nearest', 'linear', 'cubic', 'spline'
00229       spwmap -- Spectral windows combinations to form for gaintable(s)
00230                 default: [] (apply solutions from each spw to that spw only)
00231                 Example:  spwmap=[0,0,1,1] means apply the caltable solutions
00232                           from spw = 0 to the spw 0,1 and spw 1 to spw 2,3.
00233                           spwmap=[[0,0,1,1],[0,1,0,1]]
00234       gaincurve -- Apply internal VLA antenna gain curve correction (True/False)
00235                default: False;
00236                Use gaincurve=True ONLY for VLA data
00237       opacity -- Opacity correction to apply (nepers), per spw
00238                default: [] (no opacity correction for any spw)
00239                examples:
00240                    A global value for all spws:
00241                      opacity=0.051
00242                    Different values for spws 0,1,2:
00243                      opacity=[0.051, 0.055, 0.057]
00244                    (if more than 3 spws, spw 3 and higher will
00245                     be assigned the last specified value, or 0.057)
00246                Typical VLA values are: 5 GHz - 0.013, 8 GHz - 0.013
00247                15 GHz - 0.016, 23 GHz - 0.051, 43 GHz - 0.07
00248       async --  Run asynchronously
00249                default = False; do not run asychronously
00250 
00251         """
00252         a=inspect.stack()
00253         stacklevel=0
00254         for k in range(len(a)):
00255           if (string.find(a[k][1], 'ipython console') > 0) or (string.find(a[k][1], '<string>') >= 0):
00256                 stacklevel=k
00257                 break
00258         myf=sys._getframe(stacklevel).f_globals
00259         myf['__last_task'] = 'polcal'
00260         myf['taskname'] = 'polcal'
00261         ###
00262         myf['update_params'](func=myf['taskname'],printtext=False)
00263         ###
00264         ###
00265         #Handle globals or user over-ride of arguments
00266         #
00267         function_signature_defaults=dict(zip(self.__call__.func_code.co_varnames,self.__call__.func_defaults))
00268         useLocalDefaults = False
00269 
00270         for item in function_signature_defaults.iteritems():
00271                 key,val = item
00272                 keyVal = eval(key)
00273                 if (keyVal == None):
00274                         #user hasn't set it - use global/default
00275                         pass
00276                 else:
00277                         #user has set it - use over-ride
00278                         if (key != 'self') :
00279                            useLocalDefaults = True
00280                         #myf[key]=keyVal
00281 
00282         myparams = {}
00283         if useLocalDefaults :
00284            for item in function_signature_defaults.iteritems():
00285                key,val = item
00286                keyVal = eval(key)
00287                exec('myparams[key] = keyVal')
00288                if (keyVal == None):
00289                    exec('myparams[key] = '+ key + ' = self.itsdefault(key)')
00290                    keyVal = eval(key)
00291                    if(type(keyVal) == dict) :
00292                       exec('myparams[key] = ' + key + ' = keyVal[len(keyVal)-1][\'value\']')
00293 
00294         else :
00295             uselessvariable = None 
00296             myparams['vis'] = vis = myf['vis']
00297             myparams['caltable'] = caltable = myf['caltable']
00298             myparams['field'] = field = myf['field']
00299             myparams['spw'] = spw = myf['spw']
00300             myparams['intent'] = intent = myf['intent']
00301             myparams['selectdata'] = selectdata = myf['selectdata']
00302             myparams['timerange'] = timerange = myf['timerange']
00303             myparams['uvrange'] = uvrange = myf['uvrange']
00304             myparams['antenna'] = antenna = myf['antenna']
00305             myparams['scan'] = scan = myf['scan']
00306             myparams['observation'] = observation = myf['observation']
00307             myparams['msselect'] = msselect = myf['msselect']
00308             myparams['solint'] = solint = myf['solint']
00309             myparams['combine'] = combine = myf['combine']
00310             myparams['preavg'] = preavg = myf['preavg']
00311             myparams['refant'] = refant = myf['refant']
00312             myparams['minblperant'] = minblperant = myf['minblperant']
00313             myparams['minsnr'] = minsnr = myf['minsnr']
00314             myparams['poltype'] = poltype = myf['poltype']
00315             myparams['smodel'] = smodel = myf['smodel']
00316             myparams['append'] = append = myf['append']
00317             myparams['gaintable'] = gaintable = myf['gaintable']
00318             myparams['gainfield'] = gainfield = myf['gainfield']
00319             myparams['interp'] = interp = myf['interp']
00320             myparams['spwmap'] = spwmap = myf['spwmap']
00321             myparams['gaincurve'] = gaincurve = myf['gaincurve']
00322             myparams['opacity'] = opacity = myf['opacity']
00323 
00324         if type(smodel)==float: smodel=[smodel]
00325         if type(gaintable)==str: gaintable=[gaintable]
00326         if type(gainfield)==str: gainfield=[gainfield]
00327         if type(interp)==str: interp=[interp]
00328         if type(spwmap)==int: spwmap=[spwmap]
00329         if type(opacity)==float: opacity=[opacity]
00330 
00331         result = None
00332 
00333 #
00334 #    The following is work around to avoid a bug with current python translation
00335 #
00336         mytmp = {}
00337 
00338         mytmp['vis'] = vis
00339         mytmp['caltable'] = caltable
00340         mytmp['field'] = field
00341         mytmp['spw'] = spw
00342         mytmp['intent'] = intent
00343         mytmp['selectdata'] = selectdata
00344         mytmp['timerange'] = timerange
00345         mytmp['uvrange'] = uvrange
00346         mytmp['antenna'] = antenna
00347         mytmp['scan'] = scan
00348         mytmp['observation'] = observation
00349         mytmp['msselect'] = msselect
00350         mytmp['solint'] = solint
00351         mytmp['combine'] = combine
00352         mytmp['preavg'] = preavg
00353         mytmp['refant'] = refant
00354         mytmp['minblperant'] = minblperant
00355         mytmp['minsnr'] = minsnr
00356         mytmp['poltype'] = poltype
00357         mytmp['smodel'] = smodel
00358         mytmp['append'] = append
00359         mytmp['gaintable'] = gaintable
00360         mytmp['gainfield'] = gainfield
00361         mytmp['interp'] = interp
00362         mytmp['spwmap'] = spwmap
00363         mytmp['gaincurve'] = gaincurve
00364         mytmp['opacity'] = opacity
00365         pathname='file:///'+os.environ.get('CASAPATH').split()[0]+'/share/xml/'
00366         trec = casac.utils().torecord(pathname+'polcal.xml')
00367 
00368         casalog.origin('polcal')
00369         if not trec.has_key('polcal') or not casac.utils().verify(mytmp, trec['polcal']) :
00370             return False
00371 
00372 
00373         try :
00374           casalog.post('')
00375           casalog.post('##########################################')
00376           casalog.post('##### Begin Task: polcal           #####')
00377           casalog.post('')
00378           result = polcal(vis, caltable, field, spw, intent, selectdata, timerange, uvrange, antenna, scan, observation, msselect, solint, combine, preavg, refant, minblperant, minsnr, poltype, smodel, append, gaintable, gainfield, interp, spwmap, gaincurve, opacity)
00379           casalog.post('')
00380           casalog.post('##### End Task: polcal           #####')
00381           casalog.post('##########################################')
00382 
00383 
00384 # saveinputs for individule engine has no use
00385 # saveinputs should alos be removed from casa_in_py.py
00386 #
00387 #
00388 #          saveinputs = myf['saveinputs']
00389 #          saveinputs('polcal', 'polcal.last', myparams)
00390 #
00391 #
00392         except Exception, instance:
00393           #print '**** Error **** ',instance
00394           pass
00395 
00396         gc.collect()
00397         return result
00398 #
00399 #
00400 ##
00401 #    def paramgui(self, useGlobals=True):
00402 #        """
00403 #        Opens a parameter GUI for this task.  If useGlobals is true, then any relevant global parameter settings are used.
00404 #        """
00405 #        import paramgui
00406 #
00407 #        a=inspect.stack()
00408 #        stacklevel=0
00409 #        for k in range(len(a)):
00410 #          if (string.find(a[k][1], 'ipython console') > 0) or (string.find(a[k][1], '<string>') >= 0):
00411 #            stacklevel=k
00412 #            break
00413 #        myf = sys._getframe(stacklevel).f_globals
00414 #
00415 #        if useGlobals:
00416 #            paramgui.setGlobals(myf)
00417 #        else:
00418 #            paramgui.setGlobals({})
00419 #
00420 #        paramgui.runTask('polcal', myf['_ip'])
00421 #        paramgui.setGlobals({})
00422 #
00423 #
00424 #
00425 #
00426     def defaults(self, param=None):
00427         a=inspect.stack()
00428         stacklevel=0
00429         for k in range(len(a)):
00430           if (string.find(a[k][1], 'ipython console') > 0) or (string.find(a[k][1], '<string>') >= 0):
00431                 stacklevel=k
00432                 break
00433         myf=sys._getframe(stacklevel).f_globals
00434         a = odict()
00435         a['vis']  = ''
00436         a['caltable']  = ''
00437         a['field']  = ''
00438         a['spw']  = ''
00439         a['intent']  = ''
00440         a['selectdata']  = True
00441         a['solint']  = 'inf'
00442         a['combine']  = 'scan'
00443         a['preavg']  = 300.0
00444         a['refant']  = ''
00445         a['minblperant']  = 4
00446         a['minsnr']  = 3.0
00447         a['poltype']  = 'D+QU'
00448         a['smodel']  = []
00449         a['append']  = False
00450         a['gaintable']  = ['']
00451         a['gainfield']  = ['']
00452         a['interp']  = ['']
00453         a['spwmap']  = []
00454         a['gaincurve']  = False
00455         a['opacity']  = []
00456 
00457         a['async']=False
00458         a['selectdata'] = {
00459                     0:odict([{'value':True}, {'timerange':''}, {'uvrange':''}, {'antenna':''}, {'scan':''}, {'observation':''}, {'msselect':''}]), 
00460                     1:{'value':False}}
00461 
00462 ### This function sets the default values but also will return the list of
00463 ### parameters or the default value of a given parameter
00464         if(param == None):
00465                 myf['__set_default_parameters'](a)
00466         elif(param == 'paramkeys'):
00467                 return a.keys()
00468         else:
00469                 if(a.has_key(param)):
00470                    #if(type(a[param]) == dict) :
00471                    #   return a[param][len(a[param])-1]['value']
00472                    #else :
00473                       return a[param]
00474 
00475 
00476 #
00477 #
00478     def check_params(self, param=None, value=None):
00479       a=inspect.stack() 
00480       stacklevel=0
00481       for k in range(len(a)):
00482         if (string.find(a[k][1], 'ipython console') > 0) or (string.find(a[k][1], '<string>') >= 0):
00483             stacklevel=k
00484             break
00485       myf=sys._getframe(stacklevel).f_globals
00486 
00487 #      print 'param:', param, 'value:', value
00488       try :
00489          if str(type(value)) != "<type 'instance'>" :
00490             value0 = value
00491             value = myf['cu'].expandparam(param, value)
00492             matchtype = False
00493             if(type(value) == numpy.ndarray):
00494                if(type(value) == type(value0)):
00495                   myf[param] = value.tolist()
00496                else:
00497                   #print 'value:', value, 'value0:', value0
00498                   #print 'type(value):', type(value), 'type(value0):', type(value0)
00499                   myf[param] = value0
00500                   if type(value0) != list :
00501                      matchtype = True
00502             else :
00503                myf[param] = value
00504             value = myf['cu'].verifyparam({param:value})
00505             if matchtype:
00506                value = False
00507       except Exception, instance:
00508          #ignore the exception and just return it unchecked
00509          myf[param] = value
00510       return value
00511 
00512 #
00513 #
00514     def description(self, key='polcal', subkey=None):
00515         desc={'polcal': 'Determine instrumental polarization calibrations',
00516                'vis': 'Name of input visibility file',
00517                'caltable': 'Name of output gain calibration table',
00518                'field': 'Select field using field id(s) or field name(s)',
00519                'spw': 'Select spectral window/channels',
00520                'intent': 'Select observing intent',
00521                'selectdata': 'Other data selection parameters',
00522                'timerange': 'Select data based on time range',
00523                'uvrange': 'Select data within uvrange (default units meters)',
00524                'antenna': 'Select data based on antenna/baseline',
00525                'scan': 'Scan number range',
00526                'observation': 'Select by observation ID(s)',
00527                'msselect': 'Optional complex data selection (ignore for now)',
00528                'solint': 'Solution interval',
00529                'combine': 'Data axes which to combine for solve (scan, spw, and/or field)',
00530                'preavg': 'Pre-averaging interval (sec)',
00531                'refant': 'Reference antenna name(s)',
00532                'minblperant': 'Minimum baselines _per antenna_ required for solve',
00533                'minsnr': 'Reject solutions below this SNR',
00534                'poltype': 'Type of instrumental polarization solution (see help)',
00535                'smodel': 'Point source Stokes parameters for source model.',
00536                'append': 'Append solutions to the (existing) table',
00537                'gaintable': 'Gain calibration table(s) to apply',
00538                'gainfield': 'Select a subset of calibrators from gaintable(s)',
00539                'interp': 'Interpolation mode (in time) to use for each gaintable',
00540                'spwmap': 'Spectral windows combinations to form for gaintables(s)',
00541                'gaincurve': 'Apply internal VLA antenna gain curve correction',
00542                'opacity': 'Opacity correction to apply (nepers), per spw',
00543 
00544                'async': 'If true the taskname must be started using polcal(...)'
00545               }
00546 
00547 #
00548 # Set subfields defaults if needed
00549 #
00550 
00551         if(desc.has_key(key)) :
00552            return desc[key]
00553 
00554     def itsdefault(self, paramname) :
00555         a = {}
00556         a['vis']  = ''
00557         a['caltable']  = ''
00558         a['field']  = ''
00559         a['spw']  = ''
00560         a['intent']  = ''
00561         a['selectdata']  = True
00562         a['timerange']  = ''
00563         a['uvrange']  = ''
00564         a['antenna']  = ''
00565         a['scan']  = ''
00566         a['observation']  = ''
00567         a['msselect']  = ''
00568         a['solint']  = 'inf'
00569         a['combine']  = 'scan'
00570         a['preavg']  = 300.0
00571         a['refant']  = ''
00572         a['minblperant']  = 4
00573         a['minsnr']  = 3.0
00574         a['poltype']  = 'D+QU'
00575         a['smodel']  = []
00576         a['append']  = False
00577         a['gaintable']  = ['']
00578         a['gainfield']  = ['']
00579         a['interp']  = ['']
00580         a['spwmap']  = []
00581         a['gaincurve']  = False
00582         a['opacity']  = []
00583 
00584         if a.has_key(paramname) :
00585               return a[paramname]
00586 polcal_pg = polcal_pg_()