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_sdsmooth 00013 def sdsmooth(infile='', antenna=0, scanaverage=False, scanlist=[], field='', iflist=[], pollist=[], kernel='hanning', kwidth=5, chanwidth='5', verify=False, outfile='', outform='ASAP', overwrite=False, plotlevel=0): 00014 00015 """ASAP SD task: do smoothing of spectra 00016 00017 Keyword arguments: 00018 infile -- name of input SD dataset 00019 antenna -- antenna name or id (only effective for MS input). 00020 scanaverage -- average integrations within scans 00021 options: (bool) True,False 00022 default: False 00023 example: if True, this happens in read-in 00024 For GBT, set False! 00025 scanlist -- list of scan numbers to process 00026 default: [] (use all scans) 00027 example: [21,22,23,24] 00028 this selection is in addition to field, iflist, and pollist 00029 field -- selection string for selecting scans by name 00030 default: '' (no name selection) 00031 example: 'FLS3a*' 00032 this selection is in addition to scanlist, iflist,pollist 00033 iflist -- list of IF id numbers to select 00034 default: [] (use all IFs) 00035 example: [15] 00036 this selection is in addition to scanlist, field, and pollist 00037 pollist -- list of polarization id numbers to select 00038 default: [] (use all polarizations) 00039 example: [1] 00040 this selection is in addition to scanlist, field, and iflist 00041 kernel -- type of spectral smoothing 00042 options: 'hanning','gaussian','boxcar','regrid' 00043 default: 'hanning' 00044 00045 >>>kernel expandable parameter 00046 kwidth -- width of spectral smoothing kernel 00047 options: (int) in channels 00048 default: 5 00049 example: 5 or 10 seem to be popular for boxcar 00050 ignored for hanning (fixed at 5 chans) 00051 (0 will turn off gaussian or boxcar) 00052 chanwidth -- channel width of regridded spectra 00053 default: '5' (in channels) 00054 example: '500MHz', '0.2km/s' 00055 00056 verify -- verify the results of smoothing 00057 options: (bool) True,False 00058 default: False 00059 WARNING: Currently this just asks whether you accept 00060 the displayed smoothing and if not, continues 00061 without smoothing. 00062 Note: verification is not yet available for kernel='regrid' 00063 outfile -- Name of output ASAP format(scantable) file 00064 default: '' (<infile>_sm) 00065 outform -- format of output file 00066 options: 'ASCII','SDFITS','MS','ASAP' 00067 default: 'ASAP' 00068 example: the ASAP format is easiest for further sd 00069 processing; use MS for CASA imaging. 00070 If ASCII, then will append some stuff to 00071 the outfile name 00072 overwrite -- overwrite the output file if already exists 00073 options: (bool) True,False 00074 default: False 00075 WARNING: if outform='ASCII', this parameter is ignored 00076 plotlevel -- control for plotting of results 00077 options: (int) 0=none, 1=some, 2=more, <0=hardcopy 00078 default: 0 (no plotting) 00079 example: plotlevel<0 as abs(plotlevel), e.g. 00080 -1 => hardcopy of final plot (will be named 00081 <outfile>_smspec.eps) 00082 00083 00084 DESCRIPTION: 00085 00086 Task sdsmooth performs smoothing of the single-dish spectra. 00087 Set plotlevel >= 1 to plot spectrum before and after smoothing. 00088 00089 WARNING for the GBT raw SDFITS format data as input: 00090 SDtasks are able to handle GBT raw SDFITS format data since the 00091 data filler is available. However, the functionality is not well 00092 tested yet, so that there may be unknown bugs. 00093 00094 00095 """ 00096 if type(scanlist)==int: scanlist=[scanlist] 00097 if type(iflist)==int: iflist=[iflist] 00098 if type(pollist)==int: pollist=[pollist] 00099 00100 # 00101 # The following is work around to avoid a bug with current python translation 00102 # 00103 mytmp = {} 00104 00105 mytmp['infile'] = infile 00106 mytmp['antenna'] = antenna 00107 mytmp['scanaverage'] = scanaverage 00108 mytmp['scanlist'] = scanlist 00109 mytmp['field'] = field 00110 mytmp['iflist'] = iflist 00111 mytmp['pollist'] = pollist 00112 mytmp['kernel'] = kernel 00113 mytmp['kwidth'] = kwidth 00114 mytmp['chanwidth'] = chanwidth 00115 mytmp['verify'] = verify 00116 mytmp['outfile'] = outfile 00117 mytmp['outform'] = outform 00118 mytmp['overwrite'] = overwrite 00119 mytmp['plotlevel'] = plotlevel 00120 pathname='file:///'+os.environ.get('CASAPATH').split()[0]+'/share/xml/' 00121 trec = casac.utils().torecord(pathname+'sdsmooth.xml') 00122 00123 casalog.origin('sdsmooth') 00124 if trec.has_key('sdsmooth') and casac.utils().verify(mytmp, trec['sdsmooth']) : 00125 result = task_sdsmooth.sdsmooth(infile, antenna, scanaverage, scanlist, field, iflist, pollist, kernel, kwidth, chanwidth, verify, outfile, outform, overwrite, plotlevel) 00126 00127 else : 00128 result = False 00129 return result