casa
$Rev:20696$
|
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 casac 00010 import string 00011 import time 00012 import inspect 00013 import gc 00014 import numpy 00015 from odict import odict 00016 from taskmanager import tm 00017 from task_simalma import simalma 00018 class simalma_cli_: 00019 __name__ = "simalma" 00020 __async__ = {} 00021 rkey = None 00022 i_am_a_casapy_task = None 00023 # The existence of the i_am_a_casapy_task attribute allows help() 00024 # (and other) to treat casapy tasks as a special case. 00025 00026 def __init__(self) : 00027 self.__bases__ = (simalma_cli_,) 00028 self.__doc__ = self.__call__.__doc__ 00029 00030 self.parameters={'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, 'antennalist':None, 'hourangle':None, 'totaltime':None, 'acaratio':None, 'acaconfig':None, 'pwv':None, 'image':None, 'imsize':None, 'imdirection':None, 'cell':None, 'niter':None, 'threshold':None, 'graphics':None, 'verbose':None, 'overwrite':None, 'async':None} 00031 00032 00033 def result(self, key=None): 00034 #### here we will scan the task-ids in __async__ 00035 #### and add any that have completed... 00036 if key is not None and self.__async__.has_key(key) and self.__async__[key] is not None: 00037 ret = tm.retrieve(self.__async__[key]) 00038 if ret['state'] == "done" : 00039 self.__async__[key] = None 00040 elif ret['state'] == 'crashed' : 00041 self.__async__[key] = None 00042 return ret 00043 return None 00044 00045 00046 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, antennalist=None, hourangle=None, totaltime=None, acaratio=None, acaconfig=None, pwv=None, image=None, imsize=None, imdirection=None, cell=None, niter=None, threshold=None, graphics=None, verbose=None, overwrite=None, async=None): 00047 00048 """(Experimental) simple simulation task for ALMA 00049 ALMA simulation task: 00050 00051 ##### WARNING: This task is EXPERIMENTAL ##### 00052 This task simulates ALMA observation including 12-m, ACA 7-m and total 00053 power arrays, and images and analyzes simulated data. 00054 New functionality is actively being added, so if you have changed 00055 versions of CASA, check the inputs carefully. 00056 More information and examples are availible at 00057 http://casaguides.nrao.edu/index.php?title=Simulating_Observations_in_CASA 00058 Please contact CASA experts with any questions, especially 00059 about features noted below as *experimental* 00060 ------------------------------- 00061 project -- root filename for all output files. 00062 ------------------------------- 00063 skymodel -- image model of the sky in FITS or CASA image, 00064 with optional parameters that can be overridden 00065 inbright -- peak brightness in Jy/pixel, or "" for unchanged 00066 * NOTE: "unchanged" will take the numerical values in your image 00067 and assume they are in Jy/pixel, even if it says some other unit 00068 in the header. 00069 indirection -- central direction, or "" for unchanged 00070 incell -- spatial pixel size, or "" for unchanged 00071 incenter -- frequency of center channel e.g. "89GHz", or "" for unchanged 00072 inwidth -- width of channels, or "" for unchanged - this should be a 00073 string representing a quantity with units e.g. "10MHz" 00074 * NOTE: only works reliably with frequencies, not velocities 00075 * NOTE: it is not possible to change the number of spectral planes 00076 of the sky model, only to relabel them with different frequencies 00077 That kind of regridding can be accomplished with the CASA toolkit. 00078 ------------------------------- 00079 complist -- component list model of the sky, added to or instead of skymodel 00080 compwidth -- bandwidth of components; if simulating from components only, 00081 this defines the bandwidth of the MS and output images 00082 ------------------------------- 00083 setpointings -- calculate a map of pointings, or if false, provide ptgfile 00084 * if graphics are on, display the pointings shown on the model image 00085 ptgfile -- a text file specifying directions in the same 00086 format as the example, and optional integration times, e.g. 00087 #Epoch RA DEC TIME(optional) 00088 J2000 23h59m28.10 -019d52m12.35 10.0 00089 * if the time column is not present in the file, it will use 00090 "integration" for all pointings. 00091 * NOTE: at this time the file should contain only science pointings: 00092 simalma will observe these until totaltime is used up. 00093 integration --- Time interval for each integration e.g '10s' 00094 * NOTE: to simulate a "scan" longer than one integration, use 00095 setpointings to generate a pointing file, and then edit the 00096 file to increase the time at each point to be larger than 00097 the parameter integration time. 00098 direction -- mosaic center direction e.g 'J2000 19h00m00 -40d00m00' 00099 * can optionally be a list of pointings 00100 * otherwise simalma will pack mapsize with grids proper for the 00101 array (see below). 00102 mapsize -- angular size of map 00103 * set to "" to span the model image 00104 ------------------------------- 00105 antennalist -- ascii file containing antenna positions. 00106 * NOTE: In this task, it should be an ALMA configuration. 00107 * standard arrays are found in your CASA data repository, 00108 os.getenv("CASAPATH").split()[0]+"/data/alma/simmos/" 00109 * a string of the form "alma;0.5arcsec" will be parsed into a full 12m ALMA 00110 configuration. This only works for full ALMA and may fail to find the 00111 standard configuration files on some systems - see casaguides.nrao.edu 00112 hourangle -- hour angle of observation e.g. '-3h' 00113 totaltime --- total time of observation e.g '7200s' or if a number without 00114 units, interpreted as the number of times to repeat the map 00115 acaratio --- ratio of the total observation time of ACA relative to 00116 that of 12m array. Set 0 for no ACA observation. 00117 For Cycle-1, set acaratio = 0 or 3. 00118 acaconfig --- ACA configuration. Available configurations are: 00119 * "" (default) : automatically defines based on antennalist. 00120 If antennalist is Cycle-1 configuration, acaconfig='cycle1'. 00121 Otherwise, acaconfig='i' 00122 * 'cycle1' : Cycle-1 ACA-7m configuration. Uses 'aca_cycle1.cfg'. 00123 * "i" : Normal ACA configuration in full operation. Uses 'aca.i.cfg'. 00124 * "ns": North-South extended configuration in full operation. 00125 Uses 'aca.ns.cfg'. 00126 ------------------------------- 00127 pwv -- precipitable water vapor if constructing an atmospheric model. 00128 Set 0 for noise-free simulation. When pwv > 0, thermal noise is 00129 applied to the simulated data. 00130 * J. Pardo's ATM library will be used to construct anatmospheric 00131 profile for the ALMA site: 00132 altitude 5000m, ground pressure 650mbar, relhum=20%, 00133 a water layer of user_pwv at altitude of 2km, 00134 the sky brightness temperature returned by ATM, and internally 00135 tabulated receiver temperatures. 00136 See the documents of simobserve for more details. 00137 ------------------------------- 00138 image -- invert and deconvolve the simulated measurement set(s) 00139 * NOTE: interactive clean or more parameters than the subset visible 00140 here are available by simply running the clean task directly. 00141 * NOTE: the channelization of the output image cube will be the 00142 same as that in the simulated Measurement Set. 00143 * if graphics turned on, display the clean image and residual image 00144 * uses Cotton-Schwab clean for single fields and Mosaic gridding 00145 for multiple fields (with Clark PSF calculation in minor cycles). 00146 imsize -- image size in spatial pixels (x,y) 00147 0 or -1 will use the model image size; example: imsize=[500,500] 00148 imdirection -- phase center for synthesized image. default is to 00149 center on the sky model. 00150 cell -- cell size e.g '10arcsec'. "" defaults to the skymodel cell 00151 niter -- number of clean/deconvolution iterations, 0 for no cleaning 00152 threshold -- flux level to stop cleaning 00153 ------------------------------- 00154 graphics -- view plots on the screen, saved to file, both, or neither 00155 verbose -- print extra information to the logger and terminal 00156 overwrite -- overwrite existing files in the project subdirectory 00157 00158 ------------------------------- 00159 What does this task do: 00160 ------------------------------- 00161 simalma is a task to simulate ALMA observation with simple interface. 00162 It simulates ALMA 12m observation and optionally ACA 7m and Total power 00163 observations when acaratio > 0. 00164 When image=True, simulated data are imaged and analyzed. CLEAN is used 00165 to generate image(s) from simulated data. ALMA 12m and ACA data are 00166 combined (if both geneareted) by taking ACA image as an initial model 00167 in CLEAN of ALMA 12m data. 00168 NOTE this task is very experimental and may not exactly reproduce 00169 actual ALMA products. 00170 00171 The following assumptions are made to make the interface simple: 00172 * This task is intended to be run only once with a set of parameters. 00173 Therefore, it always sets up input model and pointings, and invokes simulation. 00174 You can stop before imaging step and reduce data manually with the other tasks, 00175 e.g, simanalyze, clean, and feather. 00176 * acaratio controls whether or not ACA observation is simulated. if acaratio > 0, 00177 ACA observation is simulated with total observation time = acaratio * totaltime 00178 for both ACA 7m and Total power array. 00179 * pwv controls whether or not thermal noise is applied to simulated data. 00180 When pwv > 0, the thermal noise is applied to simulated data. J. Pardo's ATM 00181 library is used to construct an atmospheric profile of the ALMA site. 00182 * if a list of directions is not specified, ALMA 12m and ACA 7m arrays will 00183 pack mapsize with the same hex algorithm as the ALMA OT in Nyquist sampling 00184 * Total power array maps slightly (+1 PB) larger area compared to 12m array for 00185 later combined imaging. It samples the region with lattice grids of spacing, 00186 0.36 lamba/d. 00187 00188 ------------------------------- 00189 How to specify a model image: 00190 ------------------------------- 00191 * simalma requires a CASA or fits image. If you merely have a grid of 00192 numbers, you will need to write them out as fits or write a CASA script to 00193 read them in and use the ia tool to create an image and insert the data. 00194 00195 * simalma does NOT require a coordinate system in the header. If the 00196 coordinate information is incomplete, missing, or you would like to 00197 override it, set the appropriate "in" paremeters. 00198 In the absence of other information, simalma will assume that the axes of 00199 your input correspond to RA, Dec, and (optionally) frequency and 00200 (optionally) Stokes parameter. 00201 00202 * If you have a proper Coordinate System, simalma will do its best to 00203 generate visibilities from that, and then create a synthesis image 00204 according to the specified user parameters. Regridding the 00205 spectral dimension may not have complete flexibility yet. 00206 00207 * You can manipulate an image header with the "imhead" task. 00208 00209 00210 Please see the documents of simobserve and simanalyze for 00211 the list of outputs produced. 00212 00213 00214 """ 00215 if not hasattr(self, "__globals__") or self.__globals__ == None : 00216 self.__globals__=sys._getframe(len(inspect.stack())-1).f_globals 00217 #casac = self.__globals__['casac'] 00218 casalog = self.__globals__['casalog'] 00219 #casalog = casac.casac.logsink() 00220 self.__globals__['__last_task'] = 'simalma' 00221 self.__globals__['taskname'] = 'simalma' 00222 ### 00223 self.__globals__['update_params'](func=self.__globals__['taskname'],printtext=False,ipython_globals=self.__globals__) 00224 ### 00225 ### 00226 #Handle globals or user over-ride of arguments 00227 # 00228 function_signature_defaults=dict(zip(self.__call__.func_code.co_varnames,self.__call__.func_defaults)) 00229 useLocalDefaults = False 00230 00231 for item in function_signature_defaults.iteritems(): 00232 key,val = item 00233 keyVal = eval(key) 00234 if (keyVal == None): 00235 #user hasn't set it - use global/default 00236 pass 00237 else: 00238 #user has set it - use over-ride 00239 if (key != 'self') : 00240 useLocalDefaults = True 00241 00242 myparams = {} 00243 if useLocalDefaults : 00244 for item in function_signature_defaults.iteritems(): 00245 key,val = item 00246 keyVal = eval(key) 00247 exec('myparams[key] = keyVal') 00248 self.parameters[key] = keyVal 00249 if (keyVal == None): 00250 exec('myparams[key] = '+ key + ' = self.itsdefault(key)') 00251 keyVal = eval(key) 00252 if(type(keyVal) == dict) : 00253 if len(keyVal) > 0 : 00254 exec('myparams[key] = ' + key + ' = keyVal[len(keyVal)-1][\'value\']') 00255 else : 00256 exec('myparams[key] = ' + key + ' = {}') 00257 00258 else : 00259 async = self.parameters['async'] 00260 myparams['project'] = project = self.parameters['project'] 00261 myparams['skymodel'] = skymodel = self.parameters['skymodel'] 00262 myparams['inbright'] = inbright = self.parameters['inbright'] 00263 myparams['indirection'] = indirection = self.parameters['indirection'] 00264 myparams['incell'] = incell = self.parameters['incell'] 00265 myparams['incenter'] = incenter = self.parameters['incenter'] 00266 myparams['inwidth'] = inwidth = self.parameters['inwidth'] 00267 myparams['complist'] = complist = self.parameters['complist'] 00268 myparams['compwidth'] = compwidth = self.parameters['compwidth'] 00269 myparams['setpointings'] = setpointings = self.parameters['setpointings'] 00270 myparams['ptgfile'] = ptgfile = self.parameters['ptgfile'] 00271 myparams['integration'] = integration = self.parameters['integration'] 00272 myparams['direction'] = direction = self.parameters['direction'] 00273 myparams['mapsize'] = mapsize = self.parameters['mapsize'] 00274 myparams['antennalist'] = antennalist = self.parameters['antennalist'] 00275 myparams['hourangle'] = hourangle = self.parameters['hourangle'] 00276 myparams['totaltime'] = totaltime = self.parameters['totaltime'] 00277 myparams['acaratio'] = acaratio = self.parameters['acaratio'] 00278 myparams['acaconfig'] = acaconfig = self.parameters['acaconfig'] 00279 myparams['pwv'] = pwv = self.parameters['pwv'] 00280 myparams['image'] = image = self.parameters['image'] 00281 myparams['imsize'] = imsize = self.parameters['imsize'] 00282 myparams['imdirection'] = imdirection = self.parameters['imdirection'] 00283 myparams['cell'] = cell = self.parameters['cell'] 00284 myparams['niter'] = niter = self.parameters['niter'] 00285 myparams['threshold'] = threshold = self.parameters['threshold'] 00286 myparams['graphics'] = graphics = self.parameters['graphics'] 00287 myparams['verbose'] = verbose = self.parameters['verbose'] 00288 myparams['overwrite'] = overwrite = self.parameters['overwrite'] 00289 00290 if type(direction)==str: direction=[direction] 00291 if type(mapsize)==str: mapsize=[mapsize] 00292 if type(imsize)==int: imsize=[imsize] 00293 00294 result = None 00295 00296 # 00297 # The following is work around to avoid a bug with current python translation 00298 # 00299 mytmp = {} 00300 00301 mytmp['project'] = project 00302 mytmp['skymodel'] = skymodel 00303 mytmp['inbright'] = inbright 00304 mytmp['indirection'] = indirection 00305 mytmp['incell'] = incell 00306 mytmp['incenter'] = incenter 00307 mytmp['inwidth'] = inwidth 00308 mytmp['complist'] = complist 00309 mytmp['compwidth'] = compwidth 00310 mytmp['setpointings'] = setpointings 00311 mytmp['ptgfile'] = ptgfile 00312 mytmp['integration'] = integration 00313 mytmp['direction'] = direction 00314 mytmp['mapsize'] = mapsize 00315 mytmp['antennalist'] = antennalist 00316 mytmp['hourangle'] = hourangle 00317 mytmp['totaltime'] = totaltime 00318 mytmp['acaratio'] = acaratio 00319 mytmp['acaconfig'] = acaconfig 00320 mytmp['pwv'] = pwv 00321 mytmp['image'] = image 00322 mytmp['imsize'] = imsize 00323 mytmp['imdirection'] = imdirection 00324 mytmp['cell'] = cell 00325 mytmp['niter'] = niter 00326 mytmp['threshold'] = threshold 00327 mytmp['graphics'] = graphics 00328 mytmp['verbose'] = verbose 00329 mytmp['overwrite'] = overwrite 00330 pathname='file:///'+os.environ.get('CASAPATH').split()[0]+'/share/xml/' 00331 trec = casac.casac.utils().torecord(pathname+'simalma.xml') 00332 00333 casalog.origin('simalma') 00334 try : 00335 #if not trec.has_key('simalma') or not casac.casac.utils().verify(mytmp, trec['simalma']) : 00336 #return False 00337 00338 casac.casac.utils().verify(mytmp, trec['simalma'], True) 00339 scriptstr=[''] 00340 saveinputs = self.__globals__['saveinputs'] 00341 saveinputs('simalma', 'simalma.last', myparams, self.__globals__,scriptstr=scriptstr) 00342 if async : 00343 count = 0 00344 keybase = time.strftime("%y%m%d.%H%M%S") 00345 key = keybase + "_" + str(count) 00346 while self.__async__.has_key(key) : 00347 count += 1 00348 key = keybase + "_" + str(count) 00349 result = tm.execute('simalma', project, skymodel, inbright, indirection, incell, incenter, inwidth, complist, compwidth, setpointings, ptgfile, integration, direction, mapsize, antennalist, hourangle, totaltime, acaratio, acaconfig, pwv, image, imsize, imdirection, cell, niter, threshold, graphics, verbose, overwrite) 00350 print "Use: " 00351 print " tm.retrieve(return_value) # to retrieve the status" 00352 print 00353 self.rkey = key 00354 self.__async__[key] = result 00355 else : 00356 tname = 'simalma' 00357 spaces = ' '*(18-len(tname)) 00358 casalog.post('\n##########################################'+ 00359 '\n##### Begin Task: ' + tname + spaces + ' #####') 00360 casalog.post(scriptstr[1][1:]+'\n', 'INFO') 00361 result = simalma(project, skymodel, inbright, indirection, incell, incenter, inwidth, complist, compwidth, setpointings, ptgfile, integration, direction, mapsize, antennalist, hourangle, totaltime, acaratio, acaconfig, pwv, image, imsize, imdirection, cell, niter, threshold, graphics, verbose, overwrite) 00362 casalog.post('##### End Task: ' + tname + ' ' + spaces + ' #####'+ 00363 '\n##########################################') 00364 00365 except Exception, instance: 00366 if(self.__globals__.has_key('__rethrow_casa_exceptions') and self.__globals__['__rethrow_casa_exceptions']) : 00367 raise 00368 else : 00369 #print '**** Error **** ',instance 00370 tname = 'simalma' 00371 casalog.post('An error occurred running task '+tname+'.', 'ERROR') 00372 pass 00373 00374 gc.collect() 00375 return result 00376 # 00377 # 00378 # 00379 def paramgui(self, useGlobals=True, ipython_globals=None): 00380 """ 00381 Opens a parameter GUI for this task. If useGlobals is true, then any relevant global parameter settings are used. 00382 """ 00383 import paramgui 00384 if not hasattr(self, "__globals__") or self.__globals__ == None : 00385 self.__globals__=sys._getframe(len(inspect.stack())-1).f_globals 00386 00387 if useGlobals: 00388 if ipython_globals == None: 00389 myf=self.__globals__ 00390 else: 00391 myf=ipython_globals 00392 00393 paramgui.setGlobals(myf) 00394 else: 00395 paramgui.setGlobals({}) 00396 00397 paramgui.runTask('simalma', myf['_ip']) 00398 paramgui.setGlobals({}) 00399 00400 # 00401 # 00402 # 00403 def defaults(self, param=None, ipython_globals=None, paramvalue=None, subparam=None): 00404 if not hasattr(self, "__globals__") or self.__globals__ == None : 00405 self.__globals__=sys._getframe(len(inspect.stack())-1).f_globals 00406 if ipython_globals == None: 00407 myf=self.__globals__ 00408 else: 00409 myf=ipython_globals 00410 00411 a = odict() 00412 a['project'] = 'sim' 00413 a['skymodel'] = '' 00414 a['complist'] = '' 00415 a['setpointings'] = True 00416 a['antennalist'] = 'alma_cycle1_1.cfg' 00417 a['hourangle'] = 'transit' 00418 a['totaltime'] = '7200s' 00419 a['acaratio'] = 0.0 00420 a['pwv'] = 0.0 00421 a['image'] = True 00422 a['graphics'] = 'both' 00423 a['verbose'] = False 00424 a['overwrite'] = False 00425 00426 a['async']=False 00427 a['skymodel'] = { 00428 0:odict([{'notvalue':''}, {'inbright':''}, {'indirection':''}, {'incell':''}, {'incenter':''}, {'inwidth':''}])} 00429 a['complist'] = { 00430 0:odict([{'notvalue':''}, {'compwidth':'8GHz'}])} 00431 a['setpointings'] = { 00432 0:odict([{'value':True}, {'integration':'10s'}, {'direction':''}, {'mapsize':['', '']}]), 00433 1:odict([{'value':False}, {'ptgfile':'$project.ptg.txt'}, {'integration':'10s'}])} 00434 a['acaratio'] = { 00435 0:odict([{'notvalue':0}, {'acaconfig':''}])} 00436 a['image'] = { 00437 0:odict([{'value':True}, {'imsize':0}, {'imdirection':''}, {'cell':''}, {'niter':500}, {'threshold':'0.1mJy'}]), 00438 1:{'value':False}} 00439 00440 ### This function sets the default values but also will return the list of 00441 ### parameters or the default value of a given parameter 00442 if(param == None): 00443 myf['__set_default_parameters'](a) 00444 elif(param == 'paramkeys'): 00445 return a.keys() 00446 else: 00447 if(paramvalue==None and subparam==None): 00448 if(a.has_key(param)): 00449 return a[param] 00450 else: 00451 return self.itsdefault(param) 00452 else: 00453 retval=a[param] 00454 if(type(a[param])==dict): 00455 for k in range(len(a[param])): 00456 valornotval='value' 00457 if(a[param][k].has_key('notvalue')): 00458 valornotval='notvalue' 00459 if((a[param][k][valornotval])==paramvalue): 00460 retval=a[param][k].copy() 00461 retval.pop(valornotval) 00462 if(subparam != None): 00463 if(retval.has_key(subparam)): 00464 retval=retval[subparam] 00465 else: 00466 retval=self.itsdefault(subparam) 00467 else: 00468 retval=self.itsdefault(subparam) 00469 return retval 00470 00471 00472 # 00473 # 00474 def check_params(self, param=None, value=None, ipython_globals=None): 00475 if ipython_globals == None: 00476 myf=self.__globals__ 00477 else: 00478 myf=ipython_globals 00479 # print 'param:', param, 'value:', value 00480 try : 00481 if str(type(value)) != "<type 'instance'>" : 00482 value0 = value 00483 value = myf['cu'].expandparam(param, value) 00484 matchtype = False 00485 if(type(value) == numpy.ndarray): 00486 if(type(value) == type(value0)): 00487 myf[param] = value.tolist() 00488 else: 00489 #print 'value:', value, 'value0:', value0 00490 #print 'type(value):', type(value), 'type(value0):', type(value0) 00491 myf[param] = value0 00492 if type(value0) != list : 00493 matchtype = True 00494 else : 00495 myf[param] = value 00496 value = myf['cu'].verifyparam({param:value}) 00497 if matchtype: 00498 value = False 00499 except Exception, instance: 00500 #ignore the exception and just return it unchecked 00501 myf[param] = value 00502 return value 00503 # 00504 # 00505 def description(self, key='simalma', subkey=None): 00506 desc={'simalma': '(Experimental) simple simulation task for ALMA ', 00507 'project': 'root prefix for output file names', 00508 'skymodel': 'model image to observe', 00509 'inbright': 'scale surface brightness of brightest pixel e.g. "1.2Jy/pixel"', 00510 'indirection': 'set new direction e.g. "J2000 19h00m00 -40d00m00"', 00511 'incell': 'set new cell/pixel size e.g. "0.1arcsec"', 00512 'incenter': 'set new frequency of center channel e.g. "89GHz" (required even for 2D model)', 00513 'inwidth': 'set new channel width e.g. "10MHz" (required even for 2D model)', 00514 'complist': 'componentlist to observe', 00515 'compwidth': 'bandwidth of components', 00516 'setpointings': '', 00517 'ptgfile': 'list of pointing positions', 00518 'integration': 'integration (sampling) time', 00519 'direction': '"J2000 19h00m00 -40d00m00" or "" to center on model', 00520 'mapsize': 'angular size of map or "" to cover model', 00521 'antennalist': 'antenna position file of ALMA 12m array', 00522 'hourangle': 'hour angle of observation center e.g. -3:00:00, or "transit"', 00523 'totaltime': 'total time of observation or number of repetitions', 00524 'acaratio': 'Ratio of the total observation time for ACA in relation to 12-m array or 0 for no ACA', 00525 'acaconfig': 'Antenna configuration of ACA 7-m array [""|"cycle1"|"i"|"ns"]', 00526 'pwv': 'Precipitable Water Vapor in mm. 0 for noise-free simulation', 00527 'image': 'image simulated data', 00528 'imsize': 'output image size in pixels (x,y) or 0 to match model', 00529 'imdirection': 'set output image direction, (otherwise center on the model)', 00530 'cell': 'cell size with units or "" to equal model', 00531 'niter': 'maximum number of iterations (0 for dirty image)', 00532 'threshold': 'flux level (+units) to stop cleaning', 00533 'graphics': 'display graphics at each stage to [screen|file|both|none]', 00534 'verbose': '', 00535 'overwrite': 'overwrite files starting with $project', 00536 00537 'async': 'If true the taskname must be started using simalma(...)' 00538 } 00539 00540 # 00541 # Set subfields defaults if needed 00542 # 00543 if(subkey == 'True'): 00544 desc['direction'] = 'center of map or "" to center on the model' 00545 if(subkey == 'False'): 00546 desc['integration'] = 'integration time (see below)' 00547 00548 if(desc.has_key(key)) : 00549 return desc[key] 00550 00551 def itsdefault(self, paramname) : 00552 a = {} 00553 a['project'] = 'sim' 00554 a['skymodel'] = '' 00555 a['inbright'] = '' 00556 a['indirection'] = '' 00557 a['incell'] = '' 00558 a['incenter'] = '' 00559 a['inwidth'] = '' 00560 a['complist'] = '' 00561 a['compwidth'] = '"8GHz"' 00562 a['setpointings'] = True 00563 a['ptgfile'] = '$project.ptg.txt' 00564 a['integration'] = '10s' 00565 a['direction'] = [''] 00566 a['mapsize'] = ['', ''] 00567 a['antennalist'] = 'alma_cycle1_1.cfg' 00568 a['hourangle'] = 'transit' 00569 a['totaltime'] = '7200s' 00570 a['acaratio'] = 0.0 00571 a['acaconfig'] = '' 00572 a['pwv'] = 0.0 00573 a['image'] = True 00574 a['imsize'] = [128, 128] 00575 a['imdirection'] = '' 00576 a['cell'] = '' 00577 a['niter'] = 500 00578 a['threshold'] = '0.1mJy' 00579 a['graphics'] = 'both' 00580 a['verbose'] = False 00581 a['overwrite'] = False 00582 00583 #a = sys._getframe(len(inspect.stack())-1).f_globals 00584 00585 if self.parameters['skymodel'] != '': 00586 a['inbright'] = '' 00587 a['indirection'] = '' 00588 a['incell'] = '' 00589 a['incenter'] = '' 00590 a['inwidth'] = '' 00591 00592 if self.parameters['complist'] != '': 00593 a['compwidth'] = '8GHz' 00594 00595 if self.parameters['setpointings'] == True: 00596 a['integration'] = '10s' 00597 a['direction'] = '' 00598 a['mapsize'] = ['', ''] 00599 00600 if self.parameters['setpointings'] == False: 00601 a['ptgfile'] = '$project.ptg.txt' 00602 a['integration'] = '10s' 00603 00604 if self.parameters['acaratio'] != 0: 00605 a['acaconfig'] = '' 00606 00607 if self.parameters['image'] == True: 00608 a['imsize'] = 0 00609 a['imdirection'] = '' 00610 a['cell'] = '' 00611 a['niter'] = 500 00612 a['threshold'] = '0.1mJy' 00613 00614 if a.has_key(paramname) : 00615 return a[paramname] 00616 simalma_cli = simalma_cli_()