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_blcal 00013 def blcal(vis='', caltable='', field='', spw='', intent='', selectdata=True, timerange='', uvrange='', antenna='', scan='', observation='', msselect='', solint='inf', combine='scan', freqdep=False, calmode='ap', solnorm=False, gaintable=[''], gainfield=[''], interp=[''], spwmap=[], gaincurve=False, opacity=[], parang=False): 00014 00015 """Calculate a baseline-based calibration solution (gain or bandpass) 00016 00017 This task determines a baseline by baseline gain (time) or bandpass (freq) 00018 for all baseline pairs in the data set. For the usual antenna-based calibration 00019 of interferometric data, this task gaincal is recommended, even with only one 00020 to three baselines. For arrays with closure errors, use blcal 00021 00022 Keyword arguments: 00023 vis -- Name of input visibility file 00024 default: none; example: vis='ngc5921.ms' 00025 caltable -- Name of output Gain calibration table 00026 default: none; example: caltable='ngc5921.gcal' 00027 00028 --- Data Selection (see help par.selectdata for more detailed information) 00029 00030 field -- Select field using field id(s) or field name(s). 00031 [run listobs to obtain the list id's or names] 00032 default: ''=all fields 00033 If field string is a non-negative integer, it is assumed a field index 00034 otherwise, it is assumed a field name 00035 field='0~2'; field ids 0,1,2 00036 field='0,4,5~7'; field ids 0,4,5,6,7 00037 field='3C286,3C295'; field named 3C286 adn 3C295 00038 field = '3,4C*'; field id 3, all names starting with 4C 00039 spw -- Select spectral window/channels 00040 default: ''=all spectral windows and channels 00041 spw='0~2,4'; spectral windows 0,1,2,4 (all channels) 00042 spw='<2'; spectral windows less than 2 (i.e. 0,1) 00043 spw='0:5~61'; spw 0, channels 5 to 61 00044 spw='0,10,3:3~45'; spw 0,10 all channels, spw 3, channels 3 to 45. 00045 spw='0~2:2~6'; spw 0,1,2 with channels 2 through 6 in each. 00046 spw='0:0~10;15~60'; spectral window 0 with channels 0-10,15-60 00047 spw='0:0~10,1:20~30,2:1;2;3'; spw 0, channels 0-10, 00048 spw 1, channels 20-30, and spw 2, channels, 1,2 and 3 00049 intent -- Select observing intent 00050 default: '' (no selection by intent) 00051 intent='*BANDPASS*' (selects data labelled with 00052 BANDPASS intent) 00053 selectdata -- Other data selection parameters 00054 default: True 00055 timerange -- Select data based on time range: 00056 default = '' (all); examples, 00057 timerange = 'YYYY/MM/DD/hh:mm:ss~YYYY/MM/DD/hh:mm:ss' 00058 Note: if YYYY/MM/DD is missing dat defaults to first day in data set 00059 timerange='09:14:0~09:54:0' picks 40 min on first day 00060 timerange= '25:00:00~27:30:00' picks 1 hr to 3 hr 30min on next day 00061 timerange='09:44:00' data within one integration of time 00062 timerange='>10:24:00' data after this time 00063 uvrange -- Select data within uvrange (default units kilo-lambda) 00064 default: '' (all); example: 00065 uvrange='0~1000kl'; uvrange from 0-1000 kilo-lamgda 00066 uvrange='>4kl';uvranges greater than 4 kilo lambda 00067 uvrange='0~1000km'; uvrange in kilometers 00068 antenna -- Select data based on antenna/baseline 00069 default: '' (all) 00070 If antenna string is a non-negative integer, it is assumed an antenna index 00071 otherwise, it is assumed as an antenna name 00072 antenna='5&6'; baseline between antenna index 5 and index 6. 00073 antenna='VA05&VA06'; baseline between VLA antenna 5 and 6. 00074 antenna='5&6;7&8'; baseline 5-6 and 7-8 00075 antenna='5'; all baselines with antenna 5 00076 antenna='5,6,10'; all baselines with antennas 5 and 6 00077 scan -- Scan number range - New, under developement 00078 observation -- Observation ID(s). 00079 default: '' = all 00080 example: '0~2,4' 00081 msselect -- Optional complex data selection (ignore for now) 00082 00083 solint -- Solution interval (units optional) 00084 default: 'inf' (~infinite, up to boundaries controlled by combine); 00085 Options: 'inf' (~infinite), 'int' (per integration), any float 00086 or integer value with or without units 00087 examples: solint='1min'; solint='60s', solint=60 --> 1 minute 00088 solint='0s'; solint=0; solint='int' --> per integration 00089 solint-'-1s'; solint='inf' --> ~infinite, up to boundaries 00090 enforced by combine 00091 combine -- Data axes to combine for solving 00092 default: 'scan' --> solutions will break at field and spw boundaries, 00093 but may extend over multiple scans (per field and spw) up 00094 to solint. 00095 Options: '','scan','spw',field', or any comma-separated combination 00096 example: combine='scan,spw' --> extend solutions over scan boundaries 00097 (up to the solint), and combine spws for solving 00098 freqdep -- Solve for frequency dependent solutions 00099 default: False (gain; True=bandpass); example: freqdep=True 00100 calmode -- Type of solution 00101 default: 'ap' (amp and phase); example: calmode='p' 00102 Options: 'p','a','ap' 00103 solnorm -- Normalize solutions. For freqdep=F, this is a global (per-spw) 00104 normalization of amplitudes (only). For freqdep=T, each baseline 00105 solution spectrum is separately normalized by its (complex) mean. 00106 default: False (no normalization) 00107 00108 gaintable -- Gain calibration table(s) to apply 00109 default: '' (none); 00110 examples: gaintable='ngc5921.gcal' 00111 gaintable=['ngc5921.ampcal','ngc5921.phcal'] 00112 gainfield -- Select a subset of calibrators from gaintable(s) 00113 default:'' ==> all sources in table; 00114 'nearest' ==> nearest (on sky) available field in table 00115 otherwise, same syntax as field 00116 example: gainfield='0~3' 00117 gainfield=['0~3','4~6'] 00118 interp -- Interpolation type (in time[,freq]) to use for each gaintable. 00119 When frequency interpolation is relevant (B, Df, Xf), 00120 separate time-dependent and freq-dependent interp 00121 types with a comma (freq _after_ the comma). 00122 Specifications for frequency are ignored when the 00123 calibration table has no channel-dependence. 00124 Time-dependent interp options ending in 'PD' enable a 00125 "phase delay" correction per spw for non-channel-dependent 00126 calibration types. 00127 default: '' --> 'linear,linear' for all gaintable(s) 00128 example: interp='nearest' (in time, freq-dep will be 00129 linear, if relevant) 00130 interp='linear,cubic' (linear in time, cubic 00131 in freq) 00132 interp=',spline' (spline in freq; linear in 00133 time by default) 00134 interp=['nearest,spline','linear'] (for multiple gaintables) 00135 Options: Time: 'nearest', 'linear' 00136 Freq: 'nearest', 'linear', 'cubic', 'spline' 00137 spwmap -- Spectral windows combinations to form for gaintable(s) 00138 default: [] (apply solutions from each spw to that spw only) 00139 Example: spwmap=[0,0,1,1] means apply the caltable solutions 00140 from spw = 0 to the spw 0,1 and spw 1 to spw 2,3. 00141 spwmap=[[0,0,1,1],[0,1,0,1]] 00142 gaincurve -- Apply internal VLA antenna gain curve correction (True/False) 00143 default: False; 00144 Use gaincurve=True ONLY for VLA data 00145 opacity -- Opacity correction to apply (nepers), per spw 00146 default: [] (no opacity correction for any spw) 00147 examples: 00148 A global value for all spws: 00149 opacity=0.051 00150 Different values for spws 0,1,2: 00151 opacity=[0.051, 0.055, 0.057] 00152 (if more than 3 spws, spw 3 and higher will 00153 be assigned the last specified value, or 0.057) 00154 Typical VLA values are: 5 GHz - 0.013, 8 GHz - 0.013 00155 15 GHz - 0.016, 23 GHz - 0.051, 43 GHz - 0.07 00156 parang -- If True, apply the parallactic angle correction (required 00157 for polarization calibration) 00158 default: False 00159 00160 00161 """ 00162 if type(gaintable)==str: gaintable=[gaintable] 00163 if type(gainfield)==str: gainfield=[gainfield] 00164 if type(interp)==str: interp=[interp] 00165 if type(spwmap)==int: spwmap=[spwmap] 00166 if type(opacity)==float: opacity=[opacity] 00167 00168 # 00169 # The following is work around to avoid a bug with current python translation 00170 # 00171 mytmp = {} 00172 00173 mytmp['vis'] = vis 00174 mytmp['caltable'] = caltable 00175 mytmp['field'] = field 00176 mytmp['spw'] = spw 00177 mytmp['intent'] = intent 00178 mytmp['selectdata'] = selectdata 00179 mytmp['timerange'] = timerange 00180 mytmp['uvrange'] = uvrange 00181 mytmp['antenna'] = antenna 00182 mytmp['scan'] = scan 00183 mytmp['observation'] = observation 00184 mytmp['msselect'] = msselect 00185 mytmp['solint'] = solint 00186 mytmp['combine'] = combine 00187 mytmp['freqdep'] = freqdep 00188 mytmp['calmode'] = calmode 00189 mytmp['solnorm'] = solnorm 00190 mytmp['gaintable'] = gaintable 00191 mytmp['gainfield'] = gainfield 00192 mytmp['interp'] = interp 00193 mytmp['spwmap'] = spwmap 00194 mytmp['gaincurve'] = gaincurve 00195 mytmp['opacity'] = opacity 00196 mytmp['parang'] = parang 00197 pathname='file:///'+os.environ.get('CASAPATH').split()[0]+'/share/xml/' 00198 trec = casac.utils().torecord(pathname+'blcal.xml') 00199 00200 casalog.origin('blcal') 00201 if trec.has_key('blcal') and casac.utils().verify(mytmp, trec['blcal']) : 00202 result = task_blcal.blcal(vis, caltable, field, spw, intent, selectdata, timerange, uvrange, antenna, scan, observation, msselect, solint, combine, freqdep, calmode, solnorm, gaintable, gainfield, interp, spwmap, gaincurve, opacity, parang) 00203 00204 else : 00205 result = False 00206 return result