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_sdimprocess 00013 def sdimprocess(infiles=[''], mode='', numpoly=2, beamsize=0.0, smoothsize=2.0, direction=[], masklist=1.0, tmax=0.0, tmin=0.0, outfile='', overwrite=False): 00014 00015 """SD task: task for single-dish image processing 00016 Keyword arguments: 00017 infiles -- name of input SD (FITS or CASA) image 00018 mode -- processing mode 00019 default: 'basket' 00020 options: 'basket', 'press' 00021 00022 >>>mode expandable parameter 00023 direction -- scan direction in unit of degree 00024 default: [] 00025 example: [0.0,90.0] 00026 masklist -- mask width for Basket-Weaving on percentage 00027 default: 1.0 (1.0% of map size) 00028 numpoly -- order of polynomial fit in Presssed-out 00029 default: 2 00030 beamsize -- beam size 00031 default: 0.0 00032 example: 10.0 (interpreted as '10arcsec'), '1arcmin' 00033 smoothsize -- smoothing beam in Pressed-out 00034 default: 2.0 (interpreted as 2.0 * beamsize) 00035 example: '1arcmin' (set smoothsize directly) 00036 00037 tmax -- maximum value used for process 00038 default: 0.0 (no threshold in maximum) 00039 example: 10.0 (mask data larger value than 10.0) 00040 tmin -- minimum value used for process 00041 default: 0.0 (no threshold in minimum) 00042 example: -10.0 (mask data smaller value than -10.0) 00043 outfile -- output CASA image name 00044 default: '' (use default name) 00045 example: 'output.im' 00046 overwrite -- overwrite option for outfile 00047 default: False (not overwrite) 00048 options: True, False 00049 example: if True, existing file will be overwritten 00050 00051 00052 DESCRIPTION: 00053 00054 Task sdimprocess is used to remove a scanning noise that appears 00055 as a striped noise pattern along the scan direction in a raster 00056 scan data. 00057 00058 By default, the scanning noise is removed by using the 00059 'Basket-Weaving' method (Emerson & Grave 1988) that requires 00060 multiple images that observed exactly the same area with different 00061 scanning direction. If only one image is available, the 'Pressed-out' 00062 method (Sofue & Reich 1979) can be used to remove the scanning 00063 effect. 00064 00065 For 'Basket-Weaving', scanning directions must have at least two 00066 different values. Normally, the scanning direction should be 00067 specified for each input image. Otherwise, specified scanning 00068 directions will be used iteratively. The masklist is a width of 00069 masking region in the Fourier plane. It is specified as a fraction 00070 (percentage) of the image size. 00071 00072 For 'Pressed-out', the scanning direction must be unique. There are 00073 two ways to specify a size of smoothing beam used for process. One 00074 is to specify smoothing size directly. To do this, smoothsize should 00075 be specified as string that consists of a numerical value and an unit 00076 (e.g. '10.0arcsec'). A value of beamsize will be ignored in this case. 00077 Another way to specify smoothing size is to set an observed beam size 00078 and indicate smoothing size as a scale factor of the observed beam 00079 size. In this case, the beamsize is interpreted as the observed beam 00080 size, and the smoothsize is the scale factor. If the beamsize is 00081 provided as float value, its unit is assumed to 'arcsec'. It is also 00082 possible to set the beamsize as string consisting of the numerical 00083 value and the unit. The smoothsize must be float value. 00084 00085 The infiles only allows an image data (CASA or FITS), and not does 00086 not work with MS or Scantable. The direction is an angle with respect 00087 to the horizontal direction, and its unit is degree. Any value may be 00088 interpreted properly, but the value ranging from 0.0 to 180.0 will be 00089 secure. The tmax and the tmin is used to specify a threshold that 00090 defines a range of spectral values used for processing. The data point 00091 that has the value larger than tmax or smaller than tmin will be 00092 excluded from the processing. The default (0.0) is no threshold. 00093 The outfile specifies an output CASA image name. If the outfile is 00094 empty, the default name ('sdimprocess.out.im') will be used. 00095 00096 """ 00097 00098 # 00099 # The following is work around to avoid a bug with current python translation 00100 # 00101 mytmp = {} 00102 00103 mytmp['infiles'] = infiles 00104 mytmp['mode'] = mode 00105 mytmp['numpoly'] = numpoly 00106 mytmp['beamsize'] = beamsize 00107 mytmp['smoothsize'] = smoothsize 00108 mytmp['direction'] = direction 00109 mytmp['masklist'] = masklist 00110 mytmp['tmax'] = tmax 00111 mytmp['tmin'] = tmin 00112 mytmp['outfile'] = outfile 00113 mytmp['overwrite'] = overwrite 00114 pathname='file:///'+os.environ.get('CASAPATH').split()[0]+'/share/xml/' 00115 trec = casac.utils().torecord(pathname+'sdimprocess.xml') 00116 00117 casalog.origin('sdimprocess') 00118 if trec.has_key('sdimprocess') and casac.utils().verify(mytmp, trec['sdimprocess']) : 00119 result = task_sdimprocess.sdimprocess(infiles, mode, numpoly, beamsize, smoothsize, direction, masklist, tmax, tmin, outfile, overwrite) 00120 00121 else : 00122 result = False 00123 return result