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_csvclean 00013 def csvclean(vis='', imagename='', field='', spw='', advise=False, mode='continuum', nchan=-1, width=1, imsize=[256, 256], cell=['1.0arcsec', '1.0arcsec'], phasecenter='', niter=500, weighting='natural', restoringbeam=[''], interactive=False): 00014 00015 """This task does an invert of the visibilities and deconvolve in the image plane. 00016 00017 This task does not do a uvdata subtraction (aka Cotton-Schwab major cycle) 00018 of model visibility as in clean. - For ALMA Commissioning 00019 00020 Keyword arguments: 00021 vis -- Name of input visibility file 00022 default: none; example: vis='ngc5921.ms' 00023 00024 imagename -- Name of output CASA image. (only the prefix) 00025 default: none; example: imagename='m2' 00026 output images are: 00027 m2.image; cleaned and restored image 00028 With or without primary beam correction 00029 m2dirty.image; dirty image 00030 m2psf.image; point-spread function (dirty beam) 00031 m2.model; image of clean components 00032 m2.mask; image containing clean regions, when interative=True 00033 00034 field -- Select fields in mosaic. Use field id(s) or field name(s). 00035 ['go listobs' to obtain the list id's or names] 00036 default: ''= all fields 00037 If field string is a non-negative integer, it is assumed to 00038 be a field index otherwise, it is assumed to be a 00039 field name 00040 field='0~2'; field ids 0,1,2 00041 field='0,4,5~7'; field ids 0,4,5,6,7 00042 field='3C286,3C295'; field named 3C286 and 3C295 00043 field = '3,4C*'; field id 3, all names starting with 4C 00044 00045 spw -- Select spectral window/channels 00046 NOTE: This selects the data passed as the INPUT to mode 00047 default: ''= all spectral windows and channels 00048 spw='0~2,4'; spectral windows 0,1,2,4 (all channels) 00049 spw='0:5~61'; spw 0, channels 5 to 61 00050 spw='<2'; spectral windows less than 2 (i.e. 0,1) 00051 spw='0,10,3:3~45'; spw 0,10 all channels, spw 3, 00052 channels 3 to 45. 00053 spw='0~2:2~6'; spw 0,1,2 with channels 2 through 6 in each. 00054 spw='0:0~10;15~60'; spectral window 0 with channels 00055 0-10,15-60 00056 spw='0:0~10,1:20~30,2:1;2;3'; spw 0, channels 0-10, 00057 spw 1, channels 20-30, and spw 2, channels, 1,2 and 3 00058 advise -- This determines whether advice for imsize and cell is 00059 requested. If set to True. It won't run clean but return 00060 values for imszise and cell estimated for the longest 00061 baseline in the data 00062 00063 imsize -- Image pixel size (x,y). DOES NOT HAVE TO BE A POWER OF 2 00064 default = [256,256]; example: imsize=[350,350] 00065 imsize = 500 is equivalent to [500,500]. 00066 Avoid odd-numbered imsize. 00067 00068 cell -- Cell size (x,y) 00069 default= '1.0arcsec'; 00070 example: cell=['0.5arcsec,'0.5arcsec'] or 00071 cell=['1arcmin', '1arcmin'] 00072 cell = '1arcsec' is equivalent to ['1arcsec','1arcsec'] 00073 NOTE:cell = 2.0 => ['2arcsec', '2arcsec'] 00074 00075 phasecenter -- direction measure or fieldid for the mosaic center 00076 default: '' => first field selected ; example: phasecenter=6 00077 or phasecenter='J2000 19h30m00 -40d00m00' 00078 00079 mode -- this determines what kind of image to make 00080 continuum or cube. In continuum all the selected data 00081 channels are combined in a 1 channel image using 00082 multifrequency synthesis. 00083 options are 'cube' and 'continuum' 00084 default: 'continuum' 00085 >>> mode='cube' expandable parameters 00086 nchan -- sets the number of channel in the output 00087 image. e.g nchan=10 00088 00089 width -- image channel width in terms of the number of 00090 channel of the first spw of the data selected 00091 e.g width=2 00092 00093 00094 00095 niter -- Maximum number of iterations, 00096 if niter=0, then no CLEANing is done ("invert" only) 00097 default: 500; example: niter=5000 00098 00099 weighting -- Weighting to apply to visibilities: 00100 default='natural'; example: weighting='uniform'; 00101 Options: 'natural','uniform','briggs', 00102 'superuniform','briggsabs','radial' 00103 00104 restoringbeam -- Output Gaussian restoring beam for CLEAN image 00105 [bmaj, bmin, bpa] elliptical Gaussian restoring beam. 00106 Default units are in arc-seconds for bmaj and bmin, and in degrees 00107 for bpa. Default: restoringbeam=[]; Use PSF calculated 00108 from dirty beam. 00109 example: restoringbeam=['10arcsec'] or restorinbeam='10arcsec', circular Gaussian. 00110 FWHM 10 arcseconds example: 00111 restoringbeam=['10.0','5.0','45.0deg'] 10"x5" 00112 at 45 degrees 00113 00114 interactive -- Create a mask interactively or not. 00115 default=False; example: interactive=True 00116 The viewer will open with the image displayed. Select the 00117 region for the mask and double click in the middle of it. 00118 00119 00120 """ 00121 if type(imsize)==int: imsize=[imsize] 00122 if type(cell)==float: cell=[cell] 00123 if type(restoringbeam)==str: restoringbeam=[restoringbeam] 00124 00125 # 00126 # The following is work around to avoid a bug with current python translation 00127 # 00128 mytmp = {} 00129 00130 mytmp['vis'] = vis 00131 mytmp['imagename'] = imagename 00132 mytmp['field'] = field 00133 mytmp['spw'] = spw 00134 mytmp['advise'] = advise 00135 mytmp['mode'] = mode 00136 mytmp['nchan'] = nchan 00137 mytmp['width'] = width 00138 mytmp['imsize'] = imsize 00139 if type(cell) == str : 00140 mytmp['cell'] = casac.quanta().quantity(cell) 00141 else : 00142 mytmp['cell'] = cell 00143 mytmp['phasecenter'] = phasecenter 00144 mytmp['niter'] = niter 00145 mytmp['weighting'] = weighting 00146 mytmp['restoringbeam'] = restoringbeam 00147 mytmp['interactive'] = interactive 00148 pathname='file:///'+os.environ.get('CASAPATH').split()[0]+'/share/xml/' 00149 trec = casac.utils().torecord(pathname+'csvclean.xml') 00150 00151 casalog.origin('csvclean') 00152 if trec.has_key('csvclean') and casac.utils().verify(mytmp, trec['csvclean']) : 00153 result = task_csvclean.csvclean(vis, imagename, field, spw, advise, mode, nchan, width, imsize, cell, phasecenter, niter, weighting, restoringbeam, interactive) 00154 00155 else : 00156 result = False 00157 return result