casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables
simobserve_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_simobserve import simobserve
00016 from task_simobserve import casalog
00017 
00018 class simobserve_pg_:
00019     __name__ = "simobserve"
00020 
00021     def __init__(self) :
00022        self.__bases__ = (simobserve_pg_,)
00023        self.__doc__ = self.__call__.__doc__
00024 
00025 
00026     def __call__(self, project=None, skymodel=None, inbright=None, indirection=None, incell=None, incenter=None, inwidth=None, complist=None, compwidth=None, setpointings=None, ptgfile=None, integration=None, direction=None, mapsize=None, maptype=None, pointingspacing=None, caldirection=None, calflux=None, obsmode=None, refdate=None, hourangle=None, totaltime=None, antennalist=None, sdantlist=None, sdant=None, thermalnoise=None, user_pwv=None, t_ground=None, t_sky=None, tau0=None, seed=None, leakage=None, graphics=None, verbose=None, overwrite=None, async=None):
00027 
00028         """mosaic simulation task
00029 mosaic simulation task:
00030 
00031     This task simulates interferometric observations (currently 
00032     only ALMA can be done easily).  New functionality is actively 
00033     being added, so if you have changed versions of CASA, check 
00034     the inputs carefully.
00035     More information and examples are availible at 
00036      http://casaguides.nrao.edu/index.php?title=Simulating_Observations_in_CASA
00037     Please contact CASA experts with any questions, especially 
00038     about features noted below as *experimental*    
00039     -------------------------------
00040     project -- root filename for all output files.
00041     -------------------------------
00042     skymodel -- image model of the sky in FITS or CASA image, 
00043          with optional parameters that can be overridden
00044     inbright -- peak brightness in Jy/pixel, or "" for unchanged
00045        * NOTE: "unchanged" will take the numerical values in your image 
00046          and assume they are in Jy/pixel, even if it says some other unit 
00047          in the header. 
00048     indirection -- central direction, or "" for unchanged
00049     incell -- spatial pixel size, or "" for unchanged
00050     incenter -- frequency of center channel e.g. "89GHz", or "" for unchanged
00051     inwidth -- width of channels, or "" for unchanged - this should be a 
00052          string representing a quantity with units e.g. "10MHz"
00053        * NOTE: only works reliably with frequencies, not velocities
00054        * NOTE: it is not possible to change the number of spectral planes
00055          of the sky model, only to relabel them with different frequencies
00056          That kind of regridding can be accomplished with the CASA toolkit.
00057     -------------------------------
00058     complist -- component list model of the sky, added to or instead of skymodel
00059     compwidth -- bandwidth of components; if simulating from components only, 
00060          this defines the bandwidth of the MS and output images
00061     -------------------------------
00062     setpointings -- calculate a map of pointings, or if false, provide ptgfile
00063        * if graphics are on, display the pointings shown on the model image
00064     ptgfile -- a text file specifying directions in the following
00065          format, with optional integration times, e.g.
00066          #Epoch     RA          DEC      TIME(optional)
00067          J2000 23h59m28.10 -019d52m12.35 10.0
00068        * if the time column is not present in the file, it will use
00069          "integration" for all pointings.
00070        * NOTE: at this time the file should contain only science pointings:
00071          simobserve will observe these, then optionally the calibrator, 
00072          then the list of science pointings again, etc, until totaltime
00073          is used up. 
00074     integration --- Time interval for each integration e.g '10s'
00075        * NOTE: to simulate a "scan" longer than one integration, use 
00076          setpointings to generate a pointing file, and then edit the 
00077          file to increase the time at each point to be larger than 
00078          the parameter integration time.
00079     direction -- mosaic center direction e.g 'J2000 19h00m00 -40d00m00'
00080        * can optionally be a list of pointings
00081        * otherwise simobserve will pack mapsize according to maptype
00082     mapsize -- angular size of map 
00083        * set to "" to span the model image
00084     maptype -- hexagonal, square (rectangular raster), 
00085          "ALMA" for the same hex algorithm as the ALMA OT 
00086          or "ALMA2012" for the algorithm used in the Cycle 0 OT
00087     pointingspacing -- spacing in between beams e.g '1arcsec'
00088          or "0.25PB" to use 1/4 of the primary beam FWHM, or 
00089          "" will use Nyquist spacing, lambda/d/sqrt(3).
00090     -------------------------------
00091     obsmode -- observation mode to calculate visibilities from skymodel (which
00092          may have been modified above, (optionally) complist, and $ptgfile (which 
00093          may have been generated above)
00094        * this parameter takes two possible values:
00095        - interferometer (or i)
00096        - singledish (or s)
00097        * if graphics are on, display the array (like plotants), the uv 
00098          coverage, the synthesized (dirty) beam, and ephemeris information
00099        * if simulating from component list, you should specify
00100          compwidth, the desired bandwidth - 
00101          there is not currently a way to specify the spectrum of a component, 
00102          so simulations from a componentlist only will be continuum (1 chan)
00103     refdate -- date of simulated observation eg: '2014/05/21'
00104     hourangle -- hour angle of observation e.g. '-3h'
00105     totaltime --- total time of observation e.g '7200s' or if a number without
00106          units, interpreted as the number of times to repeat the map
00107     antennalist -- ascii file containing antenna positions.
00108          each row has x y z coordinates and antenna diameter; 
00109          header lines are required to specify the observatory name
00110          and coordinate system e.g. 
00111            # observatory=ALMA
00112            # coordsys=UTM
00113            # datum=WGS84
00114            # zone=19
00115        * standard arrays are found in your CASA data repository, 
00116          os.getenv("CASAPATH").split()[0]+"/data/alma/simmos/"        
00117        * if "", will not not produce an interferometric MS
00118        * a string of the form "alma;0.5arcsec" will be parsed into a full 12m ALMA
00119          configuration.  This only works for full ALMA and may fail to find the 
00120          standard configuration files on some systems - see casaguides.nrao.edu
00121     caldirection -- *NEW* an unresolved calibrator can be observed 
00122          interleaved with the science pointings.  This feature is 
00123          experimental, so please contact us with any questions.
00124        * The calibrator is implemented as a point source clean component 
00125          with this direction and flux=calflux
00126     sdant -- the index of the antenna in the list to use for total 
00127          power.  defaults to the first antenna on the list. 
00128     -------------------------------
00129     thermalnoise -- add thermal noise 
00130        * this parameter takes two possible values:
00131        - tsys-atm: J. Pardo's ATM library will be used to construct an
00132            atmospheric profile for the ALMA site:
00133            altitude 5000m, ground pressure 650mbar, relhum=20%, 
00134            a water layer of user_pwv at altitude of 2km,
00135            the sky brightness temperature returned by ATM, 
00136            and internally tabulated receiver temperatures
00137        - tsys-manual: instead of using the ATM model, specify the zenith 
00138            sky brightness and opacity manually.  Noise is added and then
00139            the visibility flux scale is referenced above the atmosphere. 
00140        * In either mode, noise is calculated using an antenna spillover 
00141            efficiency of 0.96, taper of 0.86, 
00142            surface accuracy of 25 and 300 microns for ALMA and EVLA
00143            respectively (using the Ruze formula for surface efficiency),
00144            correlator efficiencies of 0.95 and 0.91 for ALMA and EVLA, 
00145            receiver temperatures for ALMA of 
00146                17, 30, 37, 51, 65, 83,147,196,175,230 K interpolated between
00147                35, 75,110,145,185,230,345,409,675,867 GHz,
00148            for EVLA of 
00149                500, 70,  60,  55,  100, 130, 350 K interpolated between
00150                0.33,1.47,4.89,8.44,22.5,33.5,43.3 GHz,
00151            for SMA of
00152                67,  116, 134, 500 K interpolated between
00153                212.,310.,383.,660. GHz
00154        * These are only approximate numbers and do not take into account 
00155          performance at edges of receiver bands, neither are they guaranteed
00156          to reflect the most recent measurements.  Caveat emptor and use the 
00157          sm tool to add noise if you want more precise control.
00158     t_ground -- ground/spillover temperature in K 
00159     user_pwv -- precipitable water vapor if constructing an atmospheric model
00160     t_sky -- atmospheric temperature in K [for tsys-manual]
00161     tau0 -- zenith opacity at observing frequency [for tsys-manual]
00162        * see casaguides.nrao.edu for more information on noise, 
00163          in particular how to add a phase screen using the toolkit
00164     seed -- random number seed for noise generation
00165     -------------------------------
00166     leakage -- add cross polarization corruption of this fractional magnitude
00167     
00168     graphics -- view plots on the screen, saved to file, both, or neither
00169     verbose -- print extra information to the logger and terminal
00170     overwrite -- overwrite existing files in the project subdirectory
00171 
00172 
00173 
00174     -------------------------------
00175     How to specify a model image:
00176     -------------------------------
00177     * simobserve requires a CASA or fits image. If you merely have a grid of 
00178       numbers, you will need to write them out as fits or write a CASA script to
00179       read them in and use the ia tool to create an image and insert the data.
00180     
00181     * simobserve does NOT require a coordinate system in the header. If the
00182       coordinate information is incomplete, missing, or you would like to
00183       override it, set the appropriate "in" paremeters.  
00184       In the absence of other information, simobserve will assume that the axes of 
00185       your input correspond to RA, Dec, and (optionally) frequency and 
00186       (optionally) Stokes parameter.  
00187 
00188     * If you have a proper Coordinate System, simobserve will do its best to
00189       generate visibilities from that, and then create a synthesis image
00190       according to the specified user parameters.  Regridding the
00191       spectral dimension may not have complete flexibility yet.
00192 
00193     * You can manipulate an image header with the "imhead" task, or you can
00194       delve deeper with the ia and cs tools.  If you use the tools, you should
00195       be aware that a CoordinateSystem in CASA can exist independently of an
00196       Image.  Once the CoordinateSystem is detached from the image, it is the
00197       user's responsibility to do any manipulation e.g. axis reordering on
00198       both. Example:
00199         ia.open("myimage_filename")
00200         ia.summary() # see header as attached to the image
00201         csys=ia.coordsys() # detach the CoordinateSystem
00202         csys.summary() # examine it
00203         csys.setreferencepixel([100,100]) 
00204         arr=ia.getchunk() # get the data from the Image
00205         ia.done()
00206         csys.reorder([0,2,1])  # reorder the CoordinateSystem
00207         arr=arr.reorder([0,2,1])  # reorder the data         
00208         ia.fromshape(outfile="mynewimage_file",shape=[32,32,256],csys=csys.torecord(),overwrite=True)
00209             # make a new image, with the right shape and CoordinateSystem
00210         ia.putchunk(arr)   # put the data into the new image.
00211         csys.done()
00212         ia.done()
00213 
00214     -------------------------------
00215     Output produced: (not all will always exist, depending on input parameters)
00216     To support different runs with different arrays, the names have the
00217     configuration name from antennalist appended.
00218     -------------------------------
00219 
00220     project.[cfg].skymodel = 4d input sky model image (optionally) scaled
00221     project.[cfg].skymodel.flat.regrid.conv = input sky regridded to match the
00222         output image, and convolved with the output clean beam
00223     project.[cfg].skymodel.png = diagnostic figure of sky model with pointings
00224 
00225     project.[cfg].ptg.txt = list of mosaic pointings
00226     project.[cfg].quick.psf = psf calculated from uv coverage
00227     project.[cfg].ms = noise-free measurement set
00228     project.[cfg].noisy.ms = corrupted measurement set 
00229     project.[cfg].observe.png = diagnostic figure of uv coverage and 
00230          visibilities
00231             
00232     project.[cfg].simobserve.last = saved input parameters for simobserve task
00233 
00234 
00235         """
00236         a=inspect.stack()
00237         stacklevel=0
00238         for k in range(len(a)):
00239           if (string.find(a[k][1], 'ipython console') > 0) or (string.find(a[k][1], '<string>') >= 0):
00240                 stacklevel=k
00241                 break
00242         myf=sys._getframe(stacklevel).f_globals
00243         myf['__last_task'] = 'simobserve'
00244         myf['taskname'] = 'simobserve'
00245         ###
00246         myf['update_params'](func=myf['taskname'],printtext=False)
00247         ###
00248         ###
00249         #Handle globals or user over-ride of arguments
00250         #
00251         function_signature_defaults=dict(zip(self.__call__.func_code.co_varnames,self.__call__.func_defaults))
00252         useLocalDefaults = False
00253 
00254         for item in function_signature_defaults.iteritems():
00255                 key,val = item
00256                 keyVal = eval(key)
00257                 if (keyVal == None):
00258                         #user hasn't set it - use global/default
00259                         pass
00260                 else:
00261                         #user has set it - use over-ride
00262                         if (key != 'self') :
00263                            useLocalDefaults = True
00264                         #myf[key]=keyVal
00265 
00266         myparams = {}
00267         if useLocalDefaults :
00268            for item in function_signature_defaults.iteritems():
00269                key,val = item
00270                keyVal = eval(key)
00271                exec('myparams[key] = keyVal')
00272                if (keyVal == None):
00273                    exec('myparams[key] = '+ key + ' = self.itsdefault(key)')
00274                    keyVal = eval(key)
00275                    if(type(keyVal) == dict) :
00276                       exec('myparams[key] = ' + key + ' = keyVal[len(keyVal)-1][\'value\']')
00277 
00278         else :
00279             uselessvariable = None 
00280             myparams['project'] = project = myf['project']
00281             myparams['skymodel'] = skymodel = myf['skymodel']
00282             myparams['inbright'] = inbright = myf['inbright']
00283             myparams['indirection'] = indirection = myf['indirection']
00284             myparams['incell'] = incell = myf['incell']
00285             myparams['incenter'] = incenter = myf['incenter']
00286             myparams['inwidth'] = inwidth = myf['inwidth']
00287             myparams['complist'] = complist = myf['complist']
00288             myparams['compwidth'] = compwidth = myf['compwidth']
00289             myparams['setpointings'] = setpointings = myf['setpointings']
00290             myparams['ptgfile'] = ptgfile = myf['ptgfile']
00291             myparams['integration'] = integration = myf['integration']
00292             myparams['direction'] = direction = myf['direction']
00293             myparams['mapsize'] = mapsize = myf['mapsize']
00294             myparams['maptype'] = maptype = myf['maptype']
00295             myparams['pointingspacing'] = pointingspacing = myf['pointingspacing']
00296             myparams['caldirection'] = caldirection = myf['caldirection']
00297             myparams['calflux'] = calflux = myf['calflux']
00298             myparams['obsmode'] = obsmode = myf['obsmode']
00299             myparams['refdate'] = refdate = myf['refdate']
00300             myparams['hourangle'] = hourangle = myf['hourangle']
00301             myparams['totaltime'] = totaltime = myf['totaltime']
00302             myparams['antennalist'] = antennalist = myf['antennalist']
00303             myparams['sdantlist'] = sdantlist = myf['sdantlist']
00304             myparams['sdant'] = sdant = myf['sdant']
00305             myparams['thermalnoise'] = thermalnoise = myf['thermalnoise']
00306             myparams['user_pwv'] = user_pwv = myf['user_pwv']
00307             myparams['t_ground'] = t_ground = myf['t_ground']
00308             myparams['t_sky'] = t_sky = myf['t_sky']
00309             myparams['tau0'] = tau0 = myf['tau0']
00310             myparams['seed'] = seed = myf['seed']
00311             myparams['leakage'] = leakage = myf['leakage']
00312             myparams['graphics'] = graphics = myf['graphics']
00313             myparams['verbose'] = verbose = myf['verbose']
00314             myparams['overwrite'] = overwrite = myf['overwrite']
00315 
00316         if type(direction)==str: direction=[direction]
00317         if type(mapsize)==str: mapsize=[mapsize]
00318 
00319         result = None
00320 
00321 #
00322 #    The following is work around to avoid a bug with current python translation
00323 #
00324         mytmp = {}
00325 
00326         mytmp['project'] = project
00327         mytmp['skymodel'] = skymodel
00328         mytmp['inbright'] = inbright
00329         mytmp['indirection'] = indirection
00330         mytmp['incell'] = incell
00331         mytmp['incenter'] = incenter
00332         mytmp['inwidth'] = inwidth
00333         mytmp['complist'] = complist
00334         mytmp['compwidth'] = compwidth
00335         mytmp['setpointings'] = setpointings
00336         mytmp['ptgfile'] = ptgfile
00337         mytmp['integration'] = integration
00338         mytmp['direction'] = direction
00339         mytmp['mapsize'] = mapsize
00340         mytmp['maptype'] = maptype
00341         mytmp['pointingspacing'] = pointingspacing
00342         mytmp['caldirection'] = caldirection
00343         mytmp['calflux'] = calflux
00344         mytmp['obsmode'] = obsmode
00345         mytmp['refdate'] = refdate
00346         mytmp['hourangle'] = hourangle
00347         mytmp['totaltime'] = totaltime
00348         mytmp['antennalist'] = antennalist
00349         mytmp['sdantlist'] = sdantlist
00350         mytmp['sdant'] = sdant
00351         mytmp['thermalnoise'] = thermalnoise
00352         mytmp['user_pwv'] = user_pwv
00353         mytmp['t_ground'] = t_ground
00354         mytmp['t_sky'] = t_sky
00355         mytmp['tau0'] = tau0
00356         mytmp['seed'] = seed
00357         mytmp['leakage'] = leakage
00358         mytmp['graphics'] = graphics
00359         mytmp['verbose'] = verbose
00360         mytmp['overwrite'] = overwrite
00361         pathname='file:///'+os.environ.get('CASAPATH').split()[0]+'/share/xml/'
00362         trec = casac.utils().torecord(pathname+'simobserve.xml')
00363 
00364         casalog.origin('simobserve')
00365         if not trec.has_key('simobserve') or not casac.utils().verify(mytmp, trec['simobserve']) :
00366             return False
00367 
00368 
00369         try :
00370           casalog.post('')
00371           casalog.post('##########################################')
00372           casalog.post('##### Begin Task: simobserve           #####')
00373           casalog.post('')
00374           result = simobserve(project, skymodel, inbright, indirection, incell, incenter, inwidth, complist, compwidth, setpointings, ptgfile, integration, direction, mapsize, maptype, pointingspacing, caldirection, calflux, obsmode, refdate, hourangle, totaltime, antennalist, sdantlist, sdant, thermalnoise, user_pwv, t_ground, t_sky, tau0, seed, leakage, graphics, verbose, overwrite)
00375           casalog.post('')
00376           casalog.post('##### End Task: simobserve           #####')
00377           casalog.post('##########################################')
00378 
00379 
00380 # saveinputs for individule engine has no use
00381 # saveinputs should alos be removed from casa_in_py.py
00382 #
00383 #
00384 #          saveinputs = myf['saveinputs']
00385 #          saveinputs('simobserve', 'simobserve.last', myparams)
00386 #
00387 #
00388         except Exception, instance:
00389           #print '**** Error **** ',instance
00390           pass
00391 
00392         gc.collect()
00393         return result
00394 #
00395 #
00396 ##
00397 #    def paramgui(self, useGlobals=True):
00398 #        """
00399 #        Opens a parameter GUI for this task.  If useGlobals is true, then any relevant global parameter settings are used.
00400 #        """
00401 #        import paramgui
00402 #
00403 #        a=inspect.stack()
00404 #        stacklevel=0
00405 #        for k in range(len(a)):
00406 #          if (string.find(a[k][1], 'ipython console') > 0) or (string.find(a[k][1], '<string>') >= 0):
00407 #            stacklevel=k
00408 #            break
00409 #        myf = sys._getframe(stacklevel).f_globals
00410 #
00411 #        if useGlobals:
00412 #            paramgui.setGlobals(myf)
00413 #        else:
00414 #            paramgui.setGlobals({})
00415 #
00416 #        paramgui.runTask('simobserve', myf['_ip'])
00417 #        paramgui.setGlobals({})
00418 #
00419 #
00420 #
00421 #
00422     def defaults(self, param=None):
00423         a=inspect.stack()
00424         stacklevel=0
00425         for k in range(len(a)):
00426           if (string.find(a[k][1], 'ipython console') > 0) or (string.find(a[k][1], '<string>') >= 0):
00427                 stacklevel=k
00428                 break
00429         myf=sys._getframe(stacklevel).f_globals
00430         a = odict()
00431         a['project']  = 'sim'
00432         a['skymodel']  = ''
00433         a['complist']  = ''
00434         a['setpointings']  = True
00435         a['obsmode']  = 'int'
00436         a['thermalnoise']  = ''
00437         a['leakage']  = 0.0
00438         a['graphics']  = 'both'
00439         a['verbose']  = False
00440         a['overwrite']  = True
00441 
00442         a['async']=False
00443         a['skymodel'] = {
00444                     0:odict([{'notvalue':''}, {'inbright':''}, {'indirection':''}, {'incell':''}, {'incenter':''}, {'inwidth':''}])}
00445         a['complist'] = {
00446                     0:odict([{'notvalue':''}, {'compwidth':'8GHz'}])}
00447         a['setpointings'] = {
00448                     0:odict([{'value':True}, {'integration':'10s'}, {'direction':''}, {'mapsize':['', '']}, {'maptype':'ALMA'}, {'pointingspacing':''}]), 
00449                     1:odict([{'value':False}, {'ptgfile':'$project.ptg.txt'}, {'integration':'10s'}])}
00450         a['obsmode'] = {
00451                     0:odict([{'value':'int'}, {'antennalist':'alma.out10.cfg'}, {'refdate':'2014/05/21'}, {'hourangle':'transit'}, {'totaltime':"7200s"}, {'caldirection':''}, {'calflux':'1Jy'}]), 
00452                     1:odict([{'value':'sd'}, {'sdantlist':'aca.tp.cfg'}, {'sdant':0}, {'refdate':'2014/05/21'}, {'hourangle':'transit'}, {'totaltime':"7200s"}]), 
00453                     2:odict([{'value':''}, {'antennalist':''}, {'sdantlist':''}, {'sdant':0}])}
00454         a['thermalnoise'] = {
00455                     0:{'value':''}, 
00456                     1:{'value':'False'}, 
00457                     2:{'value':'F'}, 
00458                     3:odict([{'value':'tsys-atm'}, {'user_pwv':1.}, {'t_ground':269.}, {'seed':11111}]), 
00459                     4:odict([{'value':'tsys-manual'}, {'t_ground':269.}, {'t_sky':263.}, {'tau0':0.1}, {'seed':11111}])}
00460 
00461 ### This function sets the default values but also will return the list of
00462 ### parameters or the default value of a given parameter
00463         if(param == None):
00464                 myf['__set_default_parameters'](a)
00465         elif(param == 'paramkeys'):
00466                 return a.keys()
00467         else:
00468                 if(a.has_key(param)):
00469                    #if(type(a[param]) == dict) :
00470                    #   return a[param][len(a[param])-1]['value']
00471                    #else :
00472                       return a[param]
00473 
00474 
00475 #
00476 #
00477     def check_params(self, param=None, value=None):
00478       a=inspect.stack() 
00479       stacklevel=0
00480       for k in range(len(a)):
00481         if (string.find(a[k][1], 'ipython console') > 0) or (string.find(a[k][1], '<string>') >= 0):
00482             stacklevel=k
00483             break
00484       myf=sys._getframe(stacklevel).f_globals
00485 
00486 #      print 'param:', param, 'value:', value
00487       try :
00488          if str(type(value)) != "<type 'instance'>" :
00489             value0 = value
00490             value = myf['cu'].expandparam(param, value)
00491             matchtype = False
00492             if(type(value) == numpy.ndarray):
00493                if(type(value) == type(value0)):
00494                   myf[param] = value.tolist()
00495                else:
00496                   #print 'value:', value, 'value0:', value0
00497                   #print 'type(value):', type(value), 'type(value0):', type(value0)
00498                   myf[param] = value0
00499                   if type(value0) != list :
00500                      matchtype = True
00501             else :
00502                myf[param] = value
00503             value = myf['cu'].verifyparam({param:value})
00504             if matchtype:
00505                value = False
00506       except Exception, instance:
00507          #ignore the exception and just return it unchecked
00508          myf[param] = value
00509       return value
00510 
00511 #
00512 #
00513     def description(self, key='simobserve', subkey=None):
00514         desc={'simobserve': 'mosaic simulation task',
00515                'project': 'root prefix for output file names',
00516                'skymodel': 'model image to observe',
00517                'inbright': 'scale surface brightness of brightest pixel e.g. "1.2Jy/pixel"',
00518                'indirection': 'set new direction e.g. "J2000 19h00m00 -40d00m00"',
00519                'incell': 'set new cell/pixel size e.g. "0.1arcsec"',
00520                'incenter': 'set new frequency of center channel e.g. "89GHz" (required even for 2D model)',
00521                'inwidth': 'set new channel width e.g. "10MHz" (required even for 2D model)',
00522                'complist': 'componentlist to observe',
00523                'compwidth': 'bandwidth of components',
00524                'setpointings': '',
00525                'ptgfile': 'list of pointing positions',
00526                'integration': 'integration (sampling) time',
00527                'direction': '"J2000 19h00m00 -40d00m00" or "" to center on model',
00528                'mapsize': 'angular size of map or "" to cover model',
00529                'maptype': 'hexagonal, square (raster), ALMA, ALMA2012',
00530                'pointingspacing': 'spacing in between pointings or "0.25PB" or "" for Nyquist',
00531                'caldirection': 'pt source calibrator [experimental]',
00532                'calflux': '',
00533                'obsmode': 'observation mode to simulate [int(interferometer)|sd(singledish)|""(none)]',
00534                'refdate': 'date of observation - not critical unless concatting simulations',
00535                'hourangle': 'hour angle of observation center e.g. -3:00:00, or "transit"',
00536                'totaltime': 'total time of observation or number of repetitions',
00537                'antennalist': 'interferometer antenna position file',
00538                'sdantlist': 'single dish antenna position file',
00539                'sdant': 'single dish antenna index in file',
00540                'thermalnoise': 'add thermal noise: [tsys-atm|tsys-manual|""]',
00541                'user_pwv': 'Precipitable Water Vapor in mm',
00542                't_ground': 'ambient temperature',
00543                't_sky': 'atmospheric temperature',
00544                'tau0': 'zenith opacity',
00545                'seed': 'random number seed',
00546                'leakage': 'cross polarization (interferometer only)',
00547                'graphics': 'display graphics at each stage to [screen|file|both|none]',
00548                'verbose': '',
00549                'overwrite': 'overwrite files starting with $project',
00550 
00551                'async': 'If true the taskname must be started using simobserve(...)'
00552               }
00553 
00554 #
00555 # Set subfields defaults if needed
00556 #
00557         if(subkey == 'True'):
00558           desc['direction'] = 'center of map or "" to center on the model'
00559         if(subkey == 'False'):
00560           desc['integration'] = 'integration time (see below)'
00561         if(subkey == ''):
00562           desc['antennalist'] = 'antenna info can be used to calculate the primary beam'
00563         if(subkey == ''):
00564           desc['sdantlist'] = 'antenna info can be used to calculate the primary beam'
00565 
00566         if(desc.has_key(key)) :
00567            return desc[key]
00568 
00569     def itsdefault(self, paramname) :
00570         a = {}
00571         a['project']  = 'sim'
00572         a['skymodel']  = ''
00573         a['inbright']  = ''
00574         a['indirection']  = ''
00575         a['incell']  = ''
00576         a['incenter']  = ''
00577         a['inwidth']  = ''
00578         a['complist']  = ''
00579         a['compwidth']  = '"8GHz"'
00580         a['setpointings']  = True
00581         a['ptgfile']  = '$project.ptg.txt'
00582         a['integration']  = '10s'
00583         a['direction']  = ['']
00584         a['mapsize']  = ['', '']
00585         a['maptype']  = 'hexagonal'
00586         a['pointingspacing']  = ''
00587         a['caldirection']  = ''
00588         a['calflux']  = '1Jy'
00589         a['obsmode']  = 'int'
00590         a['refdate']  = '2014/01/01'
00591         a['hourangle']  = 'transit'
00592         a['totaltime']  = '7200s'
00593         a['antennalist']  = ''
00594         a['sdantlist']  = ''
00595         a['sdant']  = 0
00596         a['thermalnoise']  = ''
00597         a['user_pwv']  = 1.
00598         a['t_ground']  = 270.
00599         a['t_sky']  = 260.
00600         a['tau0']  = 0.1
00601         a['seed']  = 11111
00602         a['leakage']  = 0.0
00603         a['graphics']  = 'both'
00604         a['verbose']  = False
00605         a['overwrite']  = True
00606 
00607         if a.has_key(paramname) :
00608               return a[paramname]
00609 simobserve_pg = simobserve_pg_()