casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables
setjy_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_setjy import setjy
00016 from task_setjy import casalog
00017 
00018 class setjy_pg_:
00019     __name__ = "setjy"
00020 
00021     def __init__(self) :
00022        self.__bases__ = (setjy_pg_,)
00023        self.__doc__ = self.__call__.__doc__
00024 
00025 
00026     def __call__(self, vis=None, field=None, spw=None, selectdata=None, timerange=None, scan=None, observation=None, modimage=None, listmodels=None, scalebychan=None, fluxdensity=None, spix=None, reffreq=None, standard=None, useephemdir=None, usescratch=None, async=None):
00027 
00028         """Fills the model column with the visibilities of a calibrator
00029 
00030     The task sets the model visibility amp and phase of a specified source
00031     (generally a calibrator).  The simplest way is to enter the flux density
00032     (I,Q,U,V) explicitly, but this is valid only for a point source.
00033 
00034     For an extended source, the clean model (image.model) can be
00035     specified and the model visibilities associated with this clean
00036     model is placed in the visibility model column.
00037 
00038     Models are available for 3C48, 3C138, 3C286 between 1.4 and 43 GHz.
00039     3C147 is available above 4 GHz.  These models are scaled to the precise
00040     frequency of the data.  Only I models are presently available.
00041 
00042     The location of the models is system dependent: At the AOC and CV, the
00043     models are in the directory::/usr/lib/casapy/data/nrao/VLA/CalModels or
00044     /usr/lib64/casapy/data/nrao/VLA/CalModels (depending on whether 32 or 64
00045     bit CASA was installed on the machine being used).  In general (using
00046     Python), the stock models should be in
00047     casa['dirs']['data'] + '/nrao/VLA/CalModels'
00048     setjy also looks for models in the current directory before trying
00049     casa['dirs']['data'] + '/nrao/VLA/CalModels'.
00050 
00051     setjy need only be run on the calibrator sources with a known flux
00052     density and/or model.
00053 
00054     
00055     Solar System Objects are supported via the 'Butler-JPL-Horizons 2012' 
00056     standard. This uses new brightness temperature models and a new flux
00057     calculation code that replace the 'Butler-JPL-Horizons 2010' standard.
00058     The older 'Butler-JPL-Horizons 2010' standard is still available
00059     for comparison. Users may want to use predictcomp task to see the differeces. 
00060     Currently they are modeled as uniform temperature disks based
00061     on their ephemerides at the time of observation (note that this may
00062     oversimply objects, in particular asteroids).  The object name is
00063     obtained from the 'field' parameter. Recognized objects are listed
00064     below, under 'standard'.
00065 
00066     Note that fluxdensity, modimage, and standard interact in a possibly
00067     confusing way!  Generally, if fluxdensity[0] (Stokes I) is <= 0, it
00068     will be ignored.  If it is < 0, standard (which has a default) will
00069     be used to calculate flux density as a function of frequency, even if
00070     modimage is specified.  If is is exactly 0 and modimage is given, the
00071     brightness of the model image will be used as is.  If fluxdensity([0])
00072     is > 0, it will be used.  The latter two options come at the price of
00073     disabling frequency scaling, i.e. the same fluxdensity will be used for
00074     all frequencies.
00075 
00076     Keyword arguments:
00077     vis -- Name of input visibility file
00078             default: none.  example: vis='ngc5921.ms'
00079     field -- Select field using field id(s) or field name(s).
00080            default: ''=all fields, but run setjy one field at a time.
00081               [run listobs to obtain the list id's or names of calibrators]
00082            If field is a non-negative integer, it is assumed to be a field
00083            index.  Otherwise, it is taken to be a field name (case sensitive
00084            - it must match the name as listed by listobs).
00085            field='0~2'; field ids 0,1,2
00086            field='0,4,5~7'; field ids 0,4,5,6,7
00087            field='3C286,3C295'; field named 3C286 and 3C295
00088            field = '3,4C*'; field id 3, all names starting with 4C
00089     spw -- Spectral window selection string.
00090            default: '' = all spectral windows
00091            Note that setjy only selects by spectral window, and ignores
00092            channel selections.  Fine-grained control could be achieved using
00093            (and possibly constructing) a cube for modimage.
00094 
00095     selectdata -- Other parameters for selecting part(s) of the MS
00096                   to operate on.
00097                   (Currently all time-oriented and most likely only of
00098                    interest when using a Solar System object as a calibrator.)
00099                   default: False
00100 
00101   >>> selectdata=True expandable parameters
00102                See help par.selectdata for more on these.
00103 
00104                timerange  -- Select data based on time range:
00105                    default: '' (all); examples,
00106                    timerange = 'YYYY/MM/DD/hh:mm:ss~YYYY/MM/DD/hh:mm:ss'
00107                    Note: if YYYY/MM/DD is missing date defaults to first 
00108                          day in data set
00109                    timerange='09:14:0~09:54:0' picks 40 min on first day
00110                    timerange='25:00:00~27:30:00' picks 1 hr to 3 hr 
00111                              30min on NEXT day
00112                    timerange='09:44:00' pick data within one integration 
00113                              of time
00114                    timerange='>10:24:00' data after this time
00115                    For multiple MS input, a list of timerange strings can be
00116                    used:
00117                    timerange=['09:14:0~09:54:0','>10:24:00']
00118                    timerange='09:14:0~09:54:0''; apply the same timerange for
00119                                                  all input MSes
00120                scan -- Scan number range.
00121                    default: '' (all)
00122                    example: scan='1~5'
00123                    For multiple MS input, a list of scan strings can be used:
00124                    scan=['0~100','10~200']
00125                    scan='0~100; scan ids 0-100 for all input MSes
00126                    Check 'go listobs' to insure the scan numbers are in order.
00127                observation -- Observation ID range.
00128                    default: '' (all)
00129                    example: observation='1~5'
00130 
00131 
00132     modimage -- Model image (I only) for setting the model visibilities.
00133            modimage can be a cube, and its channels do not have to exactly
00134            match those of vis.  It is recommended to use modimage for
00135            sources that are resolved by the observation, but the
00136            Butler-JPL-Horizons standard supplies a basic model of what
00137            several Solar System objects look like.  default: '': do not use
00138            a model image.
00139     
00140            Each field must be done separately when using a model image.  The
00141            flux density of the image will be scaled from the frequency in
00142            the model to that actually used (ignoring fluxdensity), unless
00143            fluxdensity >= 0 (or fluxdensity[0] >= 0).  If
00144            fluxdensity([0]) is 0.0, the image's flux density will be used.
00145            If fluxdensity([0]) > 0.0, it will be used (and spix and
00146            reffreq if modimage is not a cube).  Since the spectral index
00147            usually varies with direction, applying a single spectral index
00148            to a 2D modimage is typically not as good as using a cube.
00149 
00150            Both the amplitude and phase are calculated.  At the AOC or CV,
00151            the models are located in casa['dirs']['data']
00152            + '/nrao/VLA/CalModels/', e.g.
00153            /usr/lib/casapy/data/nrao/VLA/CalModels/3C286_L.im
00154                 lib64
00155 
00156            If modimage does not start with '/', setjy will look for a match
00157            in '.', './CalModels', and any CalModels directories within
00158            the casa['dirs']['data'] tree (excluding certain branches).
00159 
00160            Note that modimage should be deconvolved, i.e. a set of clean
00161            components instead of an image that has been convolved with a
00162            clean beam.
00163 
00164     listmodels -- If True, do nothing but list candidates for modimage
00165            (for extragalactic calibrators) that are present on the system.  It looks for *.im* *.mod* in .,
00166            CalModels, and CalModels directories in the casa['dirs']['data']
00167            tree.  It does not check whether they are appropriate for the MS!
00168            If standard='Butler-JPL-Horizons 2012', Tb models (frequency-depended
00169            brightness temperature models) for Solar System objects used in the 
00170            standard.  For standard='Butler-JPL-Horizons 2010', the recognized
00171            Solar System objects are listed. 
00172 
00173     scalebychan -- This determines whether the fluxdensity set in the model is
00174             calculated on a per channel basis. If False then it only one
00175             fluxdensity value is calculated per spw.  (Either way, all channels
00176             in spw are modified.)  It is effectively True if fluxdensity[0] >
00177             0.0. 
00178             default: True
00179 
00180     fluxdensity -- Specified flux density [I,Q,U,V] in Jy
00181             default: -1, uses [1,0,0,0] flux density for unrecognized sources,
00182             and standard flux densities for ones recognized by 'standard',
00183             including 3C286, 3C48, 3C147, and several planets, moons, and
00184             asteroids.  setjy will try to use standard if fluxdensity is not
00185             positive.
00186 
00187             Only one flux density can be specified at a time.  The phases are
00188                set to zero.
00189             example   fluxdensity=-1  will use standard for recognized
00190                       calibrators (like 3C286, 3C147 and 3C48, depending on
00191                       standard) and insert 1.0 for selected fields with
00192                       unrecognized sources.
00193             example   field = '1'; fluxdensity=[3.2,0,0,0] wil put in 
00194                       a flux density of I=3.2 for field='1'
00195 
00196             At present (June 2000), this is the only method to insert a
00197             polarized flux density model.
00198             example:  fluxdensity=[2.63,0.21,-0.33,0.02]
00199                       will put in I,Q,U,V flux densities of 2.63,0.21,-0.33,
00200                       and 0.02, respectively, in the model column.
00201 
00202     spix -- Spectral index for fluxdensity:
00203                  S = fluxdensity * (freq/reffreq)**spix
00204             Default: 0 (no effect)
00205             Only used if fluxdensity is being used.
00206             N.B.: If fluxdensity is positive, and spix is nonzero, then reffreq
00207                   must be set too!  (See below)
00208 
00209                   It is applied in the same way to all polarizations, and does
00210                   not account for Faraday rotation or depolarization.
00211 
00212     reffreq -- The reference frequency for spix, given with units.
00213             Default: '1GHz'; this is only here to prevent division by 0!
00214             N.B.: If the flux density is being scaled by spectral index,
00215             then reffreq must be set to whatever reference frequency is
00216             correct for the given fluxdensity and spix.  It cannot be
00217             determined from vis.  On the other hand, if spix is 0, then any
00218             positive frequency can be used (and ignored).
00219 
00220             Examples: '86.0GHz', '4.65e9Hz'
00221 
00222     standard -- Flux density standard, used if fluxdensity[0] < 0.0
00223             default: 'Perley-Butler 2010'; example: standard='Baars'
00224             Options: 'Baars','Perley 90','Perley-Taylor 95',
00225                'Perley-Taylor 99', 'Perley-Butler 2010', 'Perley-Butler 2013',
00226                'Butler-JPL-Horizons 2010', and 'Butler-JPL-Horizons 2012'. 
00227             All but the last two are for extragalactic calibrators,
00228             and the final two are for Solar System objects.  
00229 
00230             Extragalactic calibrators:
00231             Following source names and their common aliases are recognized.
00232             The last column shows which standards support for each source.
00233             Note that the task does not do exact matching of the name and
00234             it recognizes as long as the field name  contains the string 
00235             listed below (e.g. 'PKS 1934-638' works). 
00236             -----------------------------------------------------------
00237             3C Name B1950 Name J2000 Name Alt. J2000 Name  standards*
00238             3C48    0134+329   0137+331   J0137+3309       1,3,4,5,6
00239             3C123   0433+295   0437+296   J0437+2940       2 
00240             3C138   0518+165   0521+166   J0521+1638       1,3,4,5,6
00241             3C147   0538+498   0542+498   J0542+4951       1,3,4,5,6
00242             3C196   0809+483   0813+482   J0813+4813       1,2 
00243             3C286   1328+307   1331+305   J1331+3030       1,2,3,4,5,6
00244             3C295   1409+524   1411+522   J1411+5212       1,2,3,4,5,6
00245               -     1934-638      -       J1939-6342       1,3,4,5,6
00246             ----------------------------------------------------------- 
00247             * supported in: 1 - Perley-Butler 2010, 2 - Perley-Butler 2013,
00248             3 - Perley-Taylor 99, 4 - Perley-Taylor 95, 5 - Perley 90, 6 - Baars 
00249 
00250             Solar system objects:
00251             The 'Butler-JPL-Horizons 2012' standard is recommended over 
00252             'Butler-JPL-Horizons 2010' as the former uses updated models.
00253             Recognized Solar System objects (for 'Butler-JPL-Horizons 2012') are: 
00254              
00255                
00256                Planets: Venus, Mars, Jupiter, Uranus, Neptune
00257                
00258                Moons: Jupiter: Io, Europa, Ganymede, Callisto
00259                    Saturn:  Titan 
00260 
00261                Asteroids: Ceres, Pallas**, Vesta**, Juno**
00262 
00263             * Venus: model for ~300MHz to 350GHz, no atmospheric lines (CO,H2O,HDO, etc)
00264             * Mars: tabulated as a function of time and frequency (30 - 1000GHz) based on 
00265                Rudy el tal (1988), no atmopheric lines (CO, H20, H2O2, HDO, etc)
00266             * Jupiter: model for 30-1020GHz, does not include synchrotron emission
00267             * Uranus: model for 60-1800GHz, contains no rings or synchrotron.
00268             * Neptune: model for 2-2000GHz, the broad CO absorption line
00269                is included, but contains no rings or syncrotron. 
00270             * Titan: model for 53.3-1024.1GHz, include many spectral lines
00271 
00272             **  not recommended (The temperature is not yet adjusted for
00273                 varying distance from the Sun.  The model data can be scaled
00274                 after running setjy, but it is an involved process.)
00275 
00276                The 'field' parameter must match the case of the field name(s)
00277                in vis (as shown by listobs).
00278 
00279             Flux density calculation with Solar System objects depends on
00280             ephemerides. The setjy task looks for the data in  
00281             
00282             os.getenv('CASAPATH').split()[0] + '/data/ephemerides/JPL-Horizons'.
00283 
00284             If no ephemeris for the right object at the right time is
00285             present, the calculation will fail.  Ask the helpdesk to make an
00286             ephemeris.  The very adventurous and well versed in python can
00287             try it using CASA's recipes.ephemerides package:
00288                  import recipes.ephemerides as eph
00289                  help eph
00290 
00291             CASA comes with ephemerides for several more objects, but they
00292             are intended for use with me.framecomet(), and are not (yet)
00293             suitable flux density calibrators.  It is up to the observer to
00294             pick a good flux density calibrator (bright, spherical and
00295             featureless, on a circular orbit, in the right part of the sky,
00296             and not too resolved).  Even some of the objects listed above
00297             may prove to require more sophisticated flux density models than
00298             are currently implemented in CASA.  For many objects running
00299             casalog.filter('INFO1') before running setjy will send more
00300             information to the logger.  The cookbook also has an appendix
00301             with descriptions of the models used by setjy (both
00302             extragalactic and Solar System).
00303 
00304        >>> standard="Butler-JPL-Horizons 2012" expandable parameter
00305 
00306             useephemdir -- If True: use the direction from the ephemeris table for 
00307                 the solar system object. 
00308                 default: False -use the direction information in the MS(i.e. Field table) 
00309 
00310         usescratch  -- If False: 'virtual' model is created. The model is saved in the header 
00311         and model visibilities are evaluated when calculating calibration or plotting in plotms.
00312         If True: the model visibility will be evaluated and saved on disk in the MODEL_DATA 
00313         column.  This will increase your ms in size by a factor of 1.5 (w.r.t. the case where 
00314         you only have the DATA and the CORRECTED_DATA column).  Use True if you need to interact 
00315         with the MODEL_DATA in python, say.
00316 
00317         *By running usescratch=T, it will remove the existing virtual model from previous runs.
00318         usescratch=F will not remove the existing MODEL_DATA but in subsequent process
00319         the virtual model with matching field and spw combination will be used if it exists
00320         regardless of the presence of the MODEL_DATA column.
00321          
00322         default: False        
00323             
00324 
00325         """
00326         a=inspect.stack()
00327         stacklevel=0
00328         for k in range(len(a)):
00329           if (string.find(a[k][1], 'ipython console') > 0) or (string.find(a[k][1], '<string>') >= 0):
00330                 stacklevel=k
00331                 break
00332         myf=sys._getframe(stacklevel).f_globals
00333         myf['__last_task'] = 'setjy'
00334         myf['taskname'] = 'setjy'
00335         ###
00336         myf['update_params'](func=myf['taskname'],printtext=False)
00337         ###
00338         ###
00339         #Handle globals or user over-ride of arguments
00340         #
00341         function_signature_defaults=dict(zip(self.__call__.func_code.co_varnames,self.__call__.func_defaults))
00342         useLocalDefaults = False
00343 
00344         for item in function_signature_defaults.iteritems():
00345                 key,val = item
00346                 keyVal = eval(key)
00347                 if (keyVal == None):
00348                         #user hasn't set it - use global/default
00349                         pass
00350                 else:
00351                         #user has set it - use over-ride
00352                         if (key != 'self') :
00353                            useLocalDefaults = True
00354                         #myf[key]=keyVal
00355 
00356         myparams = {}
00357         if useLocalDefaults :
00358            for item in function_signature_defaults.iteritems():
00359                key,val = item
00360                keyVal = eval(key)
00361                exec('myparams[key] = keyVal')
00362                if (keyVal == None):
00363                    exec('myparams[key] = '+ key + ' = self.itsdefault(key)')
00364                    keyVal = eval(key)
00365                    if(type(keyVal) == dict) :
00366                       exec('myparams[key] = ' + key + ' = keyVal[len(keyVal)-1][\'value\']')
00367 
00368         else :
00369             uselessvariable = None 
00370             myparams['vis'] = vis = myf['vis']
00371             myparams['field'] = field = myf['field']
00372             myparams['spw'] = spw = myf['spw']
00373             myparams['selectdata'] = selectdata = myf['selectdata']
00374             myparams['timerange'] = timerange = myf['timerange']
00375             myparams['scan'] = scan = myf['scan']
00376             myparams['observation'] = observation = myf['observation']
00377             myparams['modimage'] = modimage = myf['modimage']
00378             myparams['listmodels'] = listmodels = myf['listmodels']
00379             myparams['scalebychan'] = scalebychan = myf['scalebychan']
00380             myparams['fluxdensity'] = fluxdensity = myf['fluxdensity']
00381             myparams['spix'] = spix = myf['spix']
00382             myparams['reffreq'] = reffreq = myf['reffreq']
00383             myparams['standard'] = standard = myf['standard']
00384             myparams['useephemdir'] = useephemdir = myf['useephemdir']
00385             myparams['usescratch'] = usescratch = myf['usescratch']
00386 
00387 
00388         result = None
00389 
00390 #
00391 #    The following is work around to avoid a bug with current python translation
00392 #
00393         mytmp = {}
00394 
00395         mytmp['vis'] = vis
00396         mytmp['field'] = field
00397         mytmp['spw'] = spw
00398         mytmp['selectdata'] = selectdata
00399         mytmp['timerange'] = timerange
00400         mytmp['scan'] = scan
00401         mytmp['observation'] = observation
00402         mytmp['modimage'] = modimage
00403         mytmp['listmodels'] = listmodels
00404         mytmp['scalebychan'] = scalebychan
00405         mytmp['fluxdensity'] = fluxdensity
00406         mytmp['spix'] = spix
00407         mytmp['reffreq'] = reffreq
00408         mytmp['standard'] = standard
00409         mytmp['useephemdir'] = useephemdir
00410         mytmp['usescratch'] = usescratch
00411         pathname='file:///'+os.environ.get('CASAPATH').split()[0]+'/share/xml/'
00412         trec = casac.utils().torecord(pathname+'setjy.xml')
00413 
00414         casalog.origin('setjy')
00415         if not trec.has_key('setjy') or not casac.utils().verify(mytmp, trec['setjy']) :
00416             return False
00417 
00418 
00419         try :
00420           casalog.post('')
00421           casalog.post('##########################################')
00422           casalog.post('##### Begin Task: setjy           #####')
00423           casalog.post('')
00424           result = setjy(vis, field, spw, selectdata, timerange, scan, observation, modimage, listmodels, scalebychan, fluxdensity, spix, reffreq, standard, useephemdir, usescratch)
00425           casalog.post('')
00426           casalog.post('##### End Task: setjy           #####')
00427           casalog.post('##########################################')
00428 
00429 
00430 # saveinputs for individule engine has no use
00431 # saveinputs should alos be removed from casa_in_py.py
00432 #
00433 #
00434 #          saveinputs = myf['saveinputs']
00435 #          saveinputs('setjy', 'setjy.last', myparams)
00436 #
00437 #
00438         except Exception, instance:
00439           #print '**** Error **** ',instance
00440           pass
00441 
00442         gc.collect()
00443         return result
00444 #
00445 #
00446 ##
00447 #    def paramgui(self, useGlobals=True):
00448 #        """
00449 #        Opens a parameter GUI for this task.  If useGlobals is true, then any relevant global parameter settings are used.
00450 #        """
00451 #        import paramgui
00452 #
00453 #        a=inspect.stack()
00454 #        stacklevel=0
00455 #        for k in range(len(a)):
00456 #          if (string.find(a[k][1], 'ipython console') > 0) or (string.find(a[k][1], '<string>') >= 0):
00457 #            stacklevel=k
00458 #            break
00459 #        myf = sys._getframe(stacklevel).f_globals
00460 #
00461 #        if useGlobals:
00462 #            paramgui.setGlobals(myf)
00463 #        else:
00464 #            paramgui.setGlobals({})
00465 #
00466 #        paramgui.runTask('setjy', myf['_ip'])
00467 #        paramgui.setGlobals({})
00468 #
00469 #
00470 #
00471 #
00472     def defaults(self, param=None):
00473         a=inspect.stack()
00474         stacklevel=0
00475         for k in range(len(a)):
00476           if (string.find(a[k][1], 'ipython console') > 0) or (string.find(a[k][1], '<string>') >= 0):
00477                 stacklevel=k
00478                 break
00479         myf=sys._getframe(stacklevel).f_globals
00480         a = odict()
00481         a['vis']  = ''
00482         a['field']  = ''
00483         a['spw']  = ''
00484         a['selectdata']  = False
00485         a['modimage']  = ''
00486         a['listmodels']  = False
00487         a['scalebychan']  = True
00488         a['fluxdensity']  = -1
00489         a['standard']  = 'Perley-Butler 2010'
00490         a['usescratch']  = False
00491 
00492         a['async']=False
00493         a['selectdata'] = {
00494                     0:{'value':False}, 
00495                     1:odict([{'value':True}, {'timerange':''}, {'scan':''}, {'observation':''}])}
00496         a['fluxdensity'] = {
00497                     0:odict([{'notvalue':-1}, {'spix':0}, {'reffreq':'1GHz'}])}
00498         a['standard'] = {
00499                     0:{'value':'Perley-Butler 2010'}, 
00500                     1:{'value':'Perley-Butler 2013'}, 
00501                     2:{'value':'Perley-Taylor 99'}, 
00502                     3:{'value':'Baars'}, 
00503                     4:{'value':'Perley 90'}, 
00504                     5:{'value':'Perley-Taylor 95'}, 
00505                     6:odict([{'value':'Butler-JPL-Horizons 2012'}, {'useephemdir':False}]), 
00506                     7:{'value':'Butler-JPL-Horizons 2010'}}
00507 
00508 ### This function sets the default values but also will return the list of
00509 ### parameters or the default value of a given parameter
00510         if(param == None):
00511                 myf['__set_default_parameters'](a)
00512         elif(param == 'paramkeys'):
00513                 return a.keys()
00514         else:
00515                 if(a.has_key(param)):
00516                    #if(type(a[param]) == dict) :
00517                    #   return a[param][len(a[param])-1]['value']
00518                    #else :
00519                       return a[param]
00520 
00521 
00522 #
00523 #
00524     def check_params(self, param=None, value=None):
00525       a=inspect.stack() 
00526       stacklevel=0
00527       for k in range(len(a)):
00528         if (string.find(a[k][1], 'ipython console') > 0) or (string.find(a[k][1], '<string>') >= 0):
00529             stacklevel=k
00530             break
00531       myf=sys._getframe(stacklevel).f_globals
00532 
00533 #      print 'param:', param, 'value:', value
00534       try :
00535          if str(type(value)) != "<type 'instance'>" :
00536             value0 = value
00537             value = myf['cu'].expandparam(param, value)
00538             matchtype = False
00539             if(type(value) == numpy.ndarray):
00540                if(type(value) == type(value0)):
00541                   myf[param] = value.tolist()
00542                else:
00543                   #print 'value:', value, 'value0:', value0
00544                   #print 'type(value):', type(value), 'type(value0):', type(value0)
00545                   myf[param] = value0
00546                   if type(value0) != list :
00547                      matchtype = True
00548             else :
00549                myf[param] = value
00550             value = myf['cu'].verifyparam({param:value})
00551             if matchtype:
00552                value = False
00553       except Exception, instance:
00554          #ignore the exception and just return it unchecked
00555          myf[param] = value
00556       return value
00557 
00558 #
00559 #
00560     def description(self, key='setjy', subkey=None):
00561         desc={'setjy': 'Fills the model column with the visibilities of a calibrator',
00562                'vis': 'Name of input visibility file',
00563                'field': 'Field name(s)',
00564                'spw': 'Spectral window identifier (list)',
00565                'selectdata': 'Other data selection parameters',
00566                'timerange': 'Time range to operate on',
00567                'scan': 'Scan number range',
00568                'observation': 'Observation ID range',
00569                'modimage': 'File location for field model',
00570                'listmodels': 'List the available modimages for VLA calibrators or Tb models for Solar System objects',
00571                'scalebychan': 'scale the flux density on a per channel basis or else on a per spw basis',
00572                'fluxdensity': 'Specified flux density [I,Q,U,V]; -1 will lookup values',
00573                'spix': 'Spectral index of fluxdensity',
00574                'reffreq': 'Reference frequency for spix',
00575                'standard': 'Flux density standard',
00576                'useephemdir': 'use directions in the ephemeris table',
00577                'usescratch': 'Will create if necessary and use the MODEL_DATA ',
00578 
00579                'async': 'If true the taskname must be started using setjy(...)'
00580               }
00581 
00582 #
00583 # Set subfields defaults if needed
00584 #
00585 
00586         if(desc.has_key(key)) :
00587            return desc[key]
00588 
00589     def itsdefault(self, paramname) :
00590         a = {}
00591         a['vis']  = ''
00592         a['field']  = ''
00593         a['spw']  = ''
00594         a['selectdata']  = False
00595         a['timerange']  = ''
00596         a['scan']  = ''
00597         a['observation']  = ''
00598         a['modimage']  = ''
00599         a['listmodels']  = False
00600         a['scalebychan']  = True
00601         a['fluxdensity']  = -1
00602         a['spix']  = 0.0
00603         a['reffreq']  = '1GHz'
00604         a['standard']  = 'Perley-Butler 2010'
00605         a['useephemdir']  = False
00606         a['usescratch']  = False
00607 
00608         if a.has_key(paramname) :
00609               return a[paramname]
00610 setjy_pg = setjy_pg_()