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_uvcontsub3 00013 def uvcontsub3(vis='', fitspw='', combine='', fitorder=0, field='', spw='', scan='', intent='', correlation='', observation=''): 00014 00015 """An experimental clone of uvcontsub 00016 00017 uvcontsub3 is an experimental clone of uvcontsub with the goal of taking 00018 less time and temporary disk space. 00019 00020 Continuum fitting and subtraction in the uv plane: 00021 00022 This task estimates the continuum emission by fitting polynomials to 00023 the real and imaginary parts of the spectral windows and channels 00024 selected by fitspw. This fit represents a model of the continuum in 00025 all channels. 00026 00027 The fitted continuum spectrum is subtracted from all channels 00028 selected in spw, and the result (presumably only line emission) 00029 is stored in a new MS (vis + ".contsub"). 00030 It will read from the CORRECTED_DATA column of vis if it is present, 00031 or DATA if it is not. Whichever column is read is presumed to have 00032 already been calibrated. 00033 00034 Keyword arguments: 00035 vis -- Name of input visibility file 00036 default: none; example: vis='ngc5921.ms' 00037 00038 fitspw -- Selection of spectral windows and channels to use in the 00039 fit for the continuum, using general spw:chan syntax. 00040 See the note under combine. 00041 default: '' (all) 00042 example: fitspw='0:5~30;40~55' 00043 00044 combine -- Let the continuum estimation span multiple spectral windows. 00045 default = '' (Make separate estimates for each spw.) 00046 combine = 'spw': Necessary when one or more of the spws are 00047 completely blanketed by lines, so the estimate 00048 must be made in different spws. 00049 00050 fitorder -- Polynomial order for the fits of the continuum w.r.t. 00051 frequency. fitorders > 1 are strongly discouraged 00052 because high order polynomials have more flexibility, may 00053 absorb line emission, and tend go wild at the edges of 00054 fitspw, which is not what you want. 00055 00056 default: 0 (constant); example: fitorder=1 00057 00058 field -- Field selection for continuum estimation and subtraction. 00059 The estimation and subtraction is done for each selected field 00060 in turn. (Run listobs to get lists of the ID and names.) 00061 default: ''=all fields. If the field string is a non-negative 00062 integer, it is assumed to be a field index 00063 otherwise, it is assumed to be a field name 00064 field='0~2'; field ids 0,1,2 00065 field='0,4,5~7'; field ids 0,4,5,6,7 00066 field='3C286,3C295'; fields named 3C286 and 3C295 00067 field = '3,4C*'; field id 3, all names starting with 4C 00068 00069 spw -- Select spectral windows for the output. 00070 default: ''=all spectral windows 00071 N.B. uvcontsub3 does not yet support exclusion by channels for 00072 the output. Meanwhile, use split to further reduce the size 00073 of the output MS if desired. 00074 spw='0~2,4'; spectral windows 0,1,2,4 00075 spw='<2'; spectral windows less than 2 (i.e. 0,1) 00076 00077 scan -- Scan number range 00078 default: ''=all 00079 00080 intent -- Select by scan intent (state). Case sensitive. 00081 default: '' = all 00082 Examples: 00083 intent = 'CALIBRATE_ATMOSPHERE_REFERENCE' 00084 intent = 'calibrate_atmosphere_reference'.upper() # same as above 00085 # Select states that include one or both of CALIBRATE_WVR.REFERENCE 00086 # or OBSERVE_TARGET_ON_SOURCE. 00087 intent = 'CALIBRATE_WVR.REFERENCE, OBSERVE_TARGET_ON_SOURCE' 00088 00089 correlation -- Select correlations, e.g. 'rr, ll' or ['XY', 'YX']. 00090 default '' (all). 00091 00092 observation -- Select by observation ID(s). 00093 default: '' = all 00094 00095 00096 """ 00097 00098 # 00099 # The following is work around to avoid a bug with current python translation 00100 # 00101 mytmp = {} 00102 00103 mytmp['vis'] = vis 00104 mytmp['fitspw'] = fitspw 00105 mytmp['combine'] = combine 00106 mytmp['fitorder'] = fitorder 00107 mytmp['field'] = field 00108 mytmp['spw'] = spw 00109 mytmp['scan'] = scan 00110 mytmp['intent'] = intent 00111 mytmp['correlation'] = correlation 00112 mytmp['observation'] = observation 00113 pathname='file:///'+os.environ.get('CASAPATH').split()[0]+'/share/xml/' 00114 trec = casac.utils().torecord(pathname+'uvcontsub3.xml') 00115 00116 casalog.origin('uvcontsub3') 00117 if trec.has_key('uvcontsub3') and casac.utils().verify(mytmp, trec['uvcontsub3']) : 00118 result = task_uvcontsub3.uvcontsub3(vis, fitspw, combine, fitorder, field, spw, scan, intent, correlation, observation) 00119 00120 else : 00121 result = False 00122 return result