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_split 00013 def split(vis='', outputvis='', datacolumn='corrected', field='', spw='', width=1, antenna='', timebin='0s', timerange='', scan='', intent='', array='', uvrange='', correlation='', observation='', combine='', keepflags=True, keepmms=False): 00014 00015 """Create a visibility subset from an existing visibility set 00016 00017 Split is the general purpose program to make a new data set that is a 00018 subset or averaged form of an existing data set. General selection 00019 parameters are included, and one or all of the various data columns 00020 (DATA, LAG_DATA and/or FLOAT_DATA, and possibly MODEL_DATA and/or 00021 CORRECTED_DATA) can be selected. 00022 00023 Split is often used after the initial calibration of the data to make a 00024 smaller measurement set with only the data that will be used in 00025 further flagging, imaging and/or self-calibration. split can 00026 average over frequency (channels) and time (integrations). 00027 00028 With the keepmms parameter, split can be run parallelized on multi-MS 00029 input. 00030 00031 Keyword arguments: 00032 vis -- Name of input visibility file 00033 default: none; example: vis='ngc5921.ms' 00034 outputvis -- Name of output visibility file 00035 default: none; example: outputvis='ngc5921_src.ms' 00036 00037 datacolumn -- Which data column to split out 00038 default='corrected'; example: datacolumn='data' 00039 Options: 'data', 'model', 'corrected', 'all', 00040 'float_data', 'lag_data', 'float_data,data', and 00041 'lag_data,data'. 00042 N.B.: 'all' = whichever of the above that are present. 00043 Otherwise the selected column will go to DATA (or 00044 FLOAT_DATA) in the output. 00045 Splitting with the default datacolumn='corrected' 00046 before clean is normally required for self-calibration! 00047 00048 --- Data Selection (see help par.selectdata for more detailed 00049 information) 00050 00051 field -- Select field using field id(s) or field name(s). 00052 [run listobs to obtain the list id's or names] 00053 default: ''=all fields If field string is a non-negative 00054 integer, it is assumed to be a field index 00055 otherwise, it is assumed to be a field name 00056 field='0~2'; field ids 0,1,2 00057 field='0,4,5~7'; field ids 0,4,5,6,7 00058 field='3C286,3C295'; fields named 3C286 and 3C295 00059 field = '3,4C*'; field id 3, all names starting with 4C 00060 spw -- Select spectral window/channels 00061 default: ''=all spectral windows and channels 00062 spw='0~2,4'; spectral windows 0,1,2,4 (all channels) 00063 spw='<2'; spectral windows less than 2 (i.e. 0,1) 00064 spw='0:5~61'; spw 0, channels 5 to 61 00065 spw='0,10,3:3~45'; spw 0,10 all channels, spw 3 - chans 3 to 45. 00066 spw='0~2:2~6'; spw 0,1,2 with channels 2 through 6 in each. 00067 spw = '*:3~64' channels 3 through 64 for all sp id's 00068 spw = ' :3~64' will NOT work. 00069 split does not support multiple channel ranges per spectral 00070 window (';') because it is not clear whether to keep the ranges 00071 in the original spectral window or make a new spectral window 00072 for each additional range. 00073 width -- Defines the number of channel to average to form the one 00074 output channel. 00075 default: '1' => no channel averaging 00076 example: width=[2,3] => average 2 channels of 1st 00077 spectral window selected and 3 in the second one. 00078 antenna -- Select data based on antenna/baseline 00079 default: '' (all) 00080 Non-negative integers are assumed to be antenna indices, and 00081 anything else is taken as an antenna name. 00082 00083 Examples: 00084 antenna='5&6': baseline between antenna index 5 and index 6. 00085 antenna='VA05&VA06': baseline between VLA antenna 5 and 6. 00086 antenna='5&6;7&8': baselines 5-6 and 7-8 00087 antenna='5': all baselines with antenna 5 00088 antenna='5,6,10': all baselines including antennas 5, 6, or 10 00089 antenna='5,6,10&': all baselines with *only* antennas 5, 6, or 00090 10. (cross-correlations only. Use && 00091 to include autocorrelations, and &&& 00092 to get only autocorrelations.) 00093 antenna='!ea03,ea12,ea17': all baselines except those that 00094 include EVLA antennas ea03, ea12, or 00095 ea17. 00096 timebin -- Interval width for time averaging. 00097 default: '0s' or '-1s' (no averaging) 00098 example: timebin='30s' 00099 '10' means '10s' 00100 timerange -- Select data based on time range: 00101 default = '' (all); examples, 00102 timerange = 'YYYY/MM/DD/hh:mm:ss~YYYY/MM/DD/hh:mm:ss' 00103 Note: if YYYY/MM/DD is missing date, timerange defaults to the 00104 first day in the dataset 00105 timerange='09:14:0~09:54:0' picks 40 min on first day 00106 timerange='25:00:00~27:30:00' picks 1 hr to 3 hr 30min 00107 on next day 00108 timerange='09:44:00' data within one integration of time 00109 timerange='>10:24:00' data after this time 00110 array -- (Sub)array number range 00111 default: ''=all 00112 uvrange -- Select data within uvrange (default units meters) 00113 default: ''=all; example: 00114 uvrange='0~1000klambda'; uvrange from 0-1000 kilo-lambda 00115 uvrange='>4klambda';uvranges greater than 4 kilo-lambda 00116 uvrange='0~1000km'; uvrange in kilometers 00117 scan -- Scan number range 00118 default: ''=all 00119 intent -- Select by scan intent (state). Case sensitive. 00120 default: '' = all 00121 Examples: 00122 intent = 'CALIBRATE_ATMOSPHERE_REFERENCE' 00123 intent = 'calibrate_atmosphere_reference'.upper() # same as above 00124 # Select states that include one or both of CALIBRATE_WVR.REFERENCE 00125 # or OBSERVE_TARGET_ON_SOURCE. 00126 intent = 'CALIBRATE_WVR.REFERENCE, OBSERVE_TARGET_ON_SOURCE' 00127 correlation -- Select correlations, e.g. 'rr, ll' or ['XY', 'YX']. 00128 default '' (all). 00129 observation -- Select by observation ID(s). 00130 default: '' = all 00131 combine -- Let time bins span changes in scan and/or state. 00132 default = '' (separate time bins by both of the above) 00133 combine = 'scan': Can be useful when the scan number 00134 goes up with each integration, 00135 as in many WSRT MSes. 00136 combine = ['scan', 'state']: disregard scan and state 00137 numbers when time averaging. 00138 combine = 'state,scan': Same as above. 00139 keepflags -- If practical, keep completely flagged rows instead of 00140 dropping them. This has absolutely no effect on averaging 00141 calculations, or partially flagged rows. All of the 00142 channels and correlations of a row must be flagged for it 00143 to be droppable, and a row must be well defined to be 00144 keepable. The latter condition means that this option has 00145 no effect on time averaging - in that case fully flagged 00146 rows are automatically omitted. Regardless of this 00147 parameter, flagged data is never included in averaging 00148 calculations. 00149 00150 The only time keepflags matters is if 00151 1. the input MS has some completely flagged rows 00152 and 00153 2. time averaging is not being done. 00154 00155 Then, if keepflags is False, the completely flagged rows 00156 will be omitted from the output MS. Otherwise, they will 00157 be included (subject to the selection parameters). 00158 00159 keepmms -- If true and the input is a multi-MS, make the output one, too. 00160 Otherwise, the output will be a normal MS without partitioning. 00161 (experimental) 00162 Default: False 00163 00164 00165 """ 00166 00167 # 00168 # The following is work around to avoid a bug with current python translation 00169 # 00170 mytmp = {} 00171 00172 mytmp['vis'] = vis 00173 mytmp['outputvis'] = outputvis 00174 mytmp['datacolumn'] = datacolumn 00175 mytmp['field'] = field 00176 mytmp['spw'] = spw 00177 mytmp['width'] = width 00178 mytmp['antenna'] = antenna 00179 mytmp['timebin'] = timebin 00180 mytmp['timerange'] = timerange 00181 mytmp['scan'] = scan 00182 mytmp['intent'] = intent 00183 mytmp['array'] = array 00184 mytmp['uvrange'] = uvrange 00185 mytmp['correlation'] = correlation 00186 mytmp['observation'] = observation 00187 mytmp['combine'] = combine 00188 mytmp['keepflags'] = keepflags 00189 mytmp['keepmms'] = keepmms 00190 pathname='file:///'+os.environ.get('CASAPATH').split()[0]+'/share/xml/' 00191 trec = casac.utils().torecord(pathname+'split.xml') 00192 00193 casalog.origin('split') 00194 if trec.has_key('split') and casac.utils().verify(mytmp, trec['split']) : 00195 result = task_split.split(vis, outputvis, datacolumn, field, spw, width, antenna, timebin, timerange, scan, intent, array, uvrange, correlation, observation, combine, keepflags, keepmms) 00196 00197 else : 00198 result = False 00199 return result