casa
$Rev:20696$
|
00001 # 00002 # This file was generated using xslt from its XML file 00003 # 00004 # Copyright 2009, Associated Universities Inc., Washington DC 00005 # 00006 import sys 00007 import os 00008 from casac import * 00009 import string 00010 from taskinit import casalog 00011 #from taskmanager import tm 00012 import task_simanalyze 00013 def simanalyze(project='sim', image=True, imagename='default', vis='default', modelimage='', cell='', imsize=[128, 128], imdirection='', niter=500, threshold='0.1mJy', weighting='natural', mask=[], outertaper=[''], stokes='I', analyze=False, showuv=True, showpsf=True, showmodel=True, showconvolved=False, showclean=True, showresidual=False, showdifference=True, showfidelity=True, graphics='both', verbose=False, overwrite=True): 00014 00015 """image and analyze simulated datasets 00016 00017 This task is for imaging and analyzing datasets created with 00018 simobserve or simalma. New functionality is actively 00019 being added, so if you have changed versions of CASA, check 00020 the inputs carefully. 00021 More information and examples are availible at 00022 http://casaguides.nrao.edu/index.php?title=Simulating_Observations_in_CASA 00023 Please contact CASA experts with any questions. 00024 ------------------------------- 00025 project -- root filename for all output files. 00026 must be the same as used when simulating the observation. 00027 in particular $project/$project.skymodel will be required 00028 to compare output and input images. 00029 image -- invert and deconvolve the measurement set(s) 00030 * NOTE: interactive clean or more parameters than the subset visible 00031 here are available by simply running the clean task directly, 00032 then returning to simanalyze to run "analyze" if desired. 00033 * NOTE: the channelization of the output image cube will be the 00034 same as that in the simulated Measurement Set. 00035 * if graphics turned on, display the clean image and residual image 00036 * uses Cotton-Schwab clean for single fields and Mosaic gridding 00037 for multiple fields (with Clark PSF calculation in minor cycles). 00038 vis -- the simulated interferometric MS, or total-power one, or both 00039 * one can use '$project' to let the task automatically replace it to 00040 the project name, e.g., vis='$project.noisy.ms,$project.noisy.sd.ms'. 00041 However, note that if you created measurement set(s) using simobserve, 00042 they will have names including the configuration, e.g. 00043 $project.alma_out20.noisy.ms 00044 * setting this paramter to "default" will find and attempt to image 00045 all measurement sets (interferometric and single dish) in the 00046 project directory 00047 modelimage -- prior (e.g. SD) image to be used in clean 00048 cell -- cell size e.g '10arcsec'. "" defaults to the skymodel cell 00049 imsize -- image size in spatial pixels (x,y) 00050 0 or -1 will use the model image size; example: imsize=[500,500] 00051 imdirection -- phase center for synthesized image. default is to 00052 center on the sky model. 00053 niter -- number of clean/deconvolution iterations, 0 for no cleaning 00054 threshold -- flux level to stop cleaning 00055 weighting -- weighting to apply to visibilities 00056 options: 'natural','uniform','briggs' (robust=0.5) 00057 mask -- Specification of cleanbox(es), mask image(s), primary beam 00058 coverage level, and/or region(s) to be used for CLEANing. 00059 CLEAN tends to perform better, and is less likely to diverge, if 00060 the CLEAN component placement is limited by a mask to where real 00061 emission is expected to be. e.g. pixel ranges mask=[110,110,150,145], 00062 filename of mask image mask='myimage.mask', or a file with mask 00063 regions -- see help for the clean task. 00064 outertaper -- apply additional uv outer taper of visibilities 00065 stokes -- Stokes parameters to image; 'I','IV','IQU','IQUV' 00066 ------------------------------- 00067 analyze -- compute and display difference between model and output, 00068 fidelity, etc. 00069 showuv -- display uv coverage 00070 showpsf -- display synthesized (dirty) beam (ignored in single dish simulation) 00071 showmodel -- display sky model at original resolution 00072 showconvolved -- display sky model convolved with output beam 00073 showclean -- display the synthesized image 00074 showresidual -- display the clean residual image (ignored in single dish simulation) 00075 showdifference -- display difference between output cleaned image and 00076 input model sky image convolved with output clean beam 00077 showfidelity -- display fidelity image 00078 fidelity = abs(input) / max[ abs(input-output), 0.7*rms(output) ] 00079 00080 graphics -- view plots on the screen, saved to file, both, or neither 00081 verbose -- print extra information to the logger and terminal 00082 overwrite -- overwrite existing files in the project subdirectory 00083 00084 Note that the RMS is calculated in the lower quarter of the image. 00085 This is likely not the best choice, so you are encouraged to 00086 measure RMS yourself in an off-source region using the viewer. 00087 00088 00089 ------------------------------- 00090 Output produced: (not all will always exist, depending on input parameters) 00091 To support different runs with different arrays, the names have the 00092 configuration name from antennalist appended. 00093 ------------------------------- 00094 project.[cfg].skymodel.flat.regrid.conv = input sky regridded to match 00095 the output image, and convolved with the output clean beam 00096 00097 project.[cfg].image = synthesized image 00098 project.[cfg].flux.pbcoverage = primary beam correction for mosaic image 00099 project.[cfg].residual = residual image after cleaning 00100 project.[cfg].clean.last = parameter file of what parameters were used in 00101 the clean task 00102 project.[cfg].psf = synthesized (dirty) beam calculated from weighted uv 00103 distribution 00104 project.[cfg].image.png = diagnostic figure of clean image and residual 00105 00106 project.[cfg].fidelity = fidelity image 00107 project.[cfg].analysis.png = diagnostic figure of difference and fidelity 00108 00109 project.[cfg].simanalyze.last = saved input parameters for simanalyze task 00110 00111 00112 """ 00113 if type(imsize)==int: imsize=[imsize] 00114 if type(outertaper)==str: outertaper=[outertaper] 00115 00116 # 00117 # The following is work around to avoid a bug with current python translation 00118 # 00119 mytmp = {} 00120 00121 mytmp['project'] = project 00122 mytmp['image'] = image 00123 mytmp['imagename'] = imagename 00124 mytmp['vis'] = vis 00125 mytmp['modelimage'] = modelimage 00126 mytmp['cell'] = cell 00127 mytmp['imsize'] = imsize 00128 mytmp['imdirection'] = imdirection 00129 mytmp['niter'] = niter 00130 mytmp['threshold'] = threshold 00131 mytmp['weighting'] = weighting 00132 mytmp['mask'] = mask 00133 mytmp['outertaper'] = outertaper 00134 mytmp['stokes'] = stokes 00135 mytmp['analyze'] = analyze 00136 mytmp['showuv'] = showuv 00137 mytmp['showpsf'] = showpsf 00138 mytmp['showmodel'] = showmodel 00139 mytmp['showconvolved'] = showconvolved 00140 mytmp['showclean'] = showclean 00141 mytmp['showresidual'] = showresidual 00142 mytmp['showdifference'] = showdifference 00143 mytmp['showfidelity'] = showfidelity 00144 mytmp['graphics'] = graphics 00145 mytmp['verbose'] = verbose 00146 mytmp['overwrite'] = overwrite 00147 pathname='file:///'+os.environ.get('CASAPATH').split()[0]+'/share/xml/' 00148 trec = casac.utils().torecord(pathname+'simanalyze.xml') 00149 00150 casalog.origin('simanalyze') 00151 if trec.has_key('simanalyze') and casac.utils().verify(mytmp, trec['simanalyze']) : 00152 result = task_simanalyze.simanalyze(project, image, imagename, vis, modelimage, cell, imsize, imdirection, niter, threshold, weighting, mask, outertaper, stokes, analyze, showuv, showpsf, showmodel, showconvolved, showclean, showresidual, showdifference, showfidelity, graphics, verbose, overwrite) 00153 00154 else : 00155 result = False 00156 return result