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_partition 00013 def partition(vis='', outputvis='', createmms=True, separationaxis='scan', numsubms=64, datacolumn='data', calmsselection='none', calmsname='', calfield='', calscan='', calintent='', field='', spw='', antenna='', timebin='0s', combine='', timerange='', scan='', scanintent='', array='', uvrange='', observation=''): 00014 00015 """Experimental task to produce multi-MSs using parallelism 00016 Experimental version for use with parallelization framework. 00017 Do not use this for standard analysis... yet. 00018 00019 Partition is a task to create a multi-MS out of an MS. General selection 00020 parameters are included, and one or all of the various data columns 00021 (DATA, LAG_DATA and/or FLOAT_DATA, and possibly MODEL_DATA and/or 00022 CORRECTED_DATA) can be selected. It can also be used to create a normal 00023 MS, split based on the given data selection parameters. 00024 00025 The partition task creates a multi-MS using the parallelization framework. 00026 If a cluster is not present, it will create a default cluster based on the 00027 resources of the system. One can create a simple_cluster prior to running 00028 partition by doing the following. 00029 00030 from simple_cluster import * 00031 sc = simple_cluster() 00032 sc.init_cluster('cluster-config.txt', 'test') 00033 00034 The file 'cluster-config.txt' contains information on the machine that will 00035 be used for the cluster. Please see the help of simple_cluster for more information. 00036 00037 A multi-MS is structured to have a reference MS on the top directory and a 00038 sub-directory called SUBMSS, which contain each partitioned sub-MS. The 00039 reference MS contains links to the sub-tables of the first sub-MS. The other 00040 sub-MSs contain a copy of the sub-tables each. A multi-MS looks like this in disk. 00041 00042 ls ngc5921.mms 00043 ANTENNA FLAG_CMD POLARIZATION SPECTRAL_WINDOW table.dat 00044 DATA_DESCRIPTION HISTORY PROCESSOR STATE table.info 00045 FEED OBSERVATION SORTED_TABLE SUBMSS WEATHER 00046 FIELD POINTING SOURCE SYSCAL 00047 00048 ls ngc5921.mms/SUBMSS/ 00049 ngc5921.0000.ms/ ngc5921t.0002.ms/ ngc5921.0004.ms/ ngc5921.0006.ms/ 00050 ngc5921.0001.ms/ ngc5921.0003.ms/ ngc5921.0005.ms/ 00051 00052 Inside casapy, one can use the task listpartition to list the information 00053 from a multi-MS. 00054 00055 00056 Keyword arguments: 00057 vis -- Name of input visibility file 00058 default: none; example: vis='ngc5921.ms' 00059 00060 outputvis -- Name of output visibility file 00061 default: none; example: outputvis='ngc5921.mms' 00062 00063 createmms -- Create a multi-MS as the output. 00064 default: True 00065 If False, it will work like the split task and create a 00066 normal MS, split according to the given data selection parameters. 00067 Note that, when this parameter is set to False, a simple_cluster 00068 will not be created. 00069 00070 separationaxis -- Axis to do parallelization across. 00071 default: 'scan' 00072 Options: 'scan', 'spw', 'both' 00073 The 'both' option will try to partition in both scan and spw axes. 00074 00075 numsubms -- The number of sub-MSs to create. 00076 default: 64 00077 00078 00079 datacolumn -- Which data column to use when partitioning. 00080 default='data'; example: datacolumn='data' 00081 Options: 'data', 'model', 'corrected', 'all', 00082 'float_data', 'lag_data', 'float_data,data', and 00083 'lag_data,data'. 00084 N.B.: 'all' = whichever of the above that are present. 00085 Otherwise the selected column will go to DATA (or 00086 FLOAT_DATA) in the output. 00087 00088 calmsselection -- Method by which the calibration scans will be identified 00089 when creating a separate calibration MS. 00090 default:'none' 00091 Options: 'none', 'auto', 'manual'. 00092 00093 'auto' -- 00094 calmsname -- Name of output measurement set. 00095 default = ' ' 00096 00097 'manual' 00098 calmsname -- Name of output measurement set. 00099 default: '' 00100 calfield -- Field selection for calibration MS. 00101 default: '' 00102 calscans -- Scan selection for calibration MS. 00103 default: '' 00104 calintent -- Scan intent selection for calibration MS. 00105 default: '' 00106 00107 --- Data selection parameters (see help par.selectdata for more detailed 00108 information) 00109 00110 field -- Select field using field id(s) or field name(s). 00111 [run listobs to obtain the list iof d's or names] 00112 default: ''=all fields If field string is a non-negative 00113 integer, it is assumed to be a field index 00114 otherwise, it is assumed to be a field name 00115 field='0~2'; field ids 0,1,2 00116 field='0,4,5~7'; field ids 0,4,5,6,7 00117 field='3C286,3C295'; fields named 3C286 and 3C295 00118 field = '3,4C*'; field id 3, all names starting with 4C 00119 00120 spw -- Select spectral window/channels 00121 default: ''=all spectral windows and channels 00122 spw='0~2,4'; spectral windows 0,1,2,4 (all channels) 00123 spw='<2'; spectral windows less than 2 (i.e. 0,1) 00124 spw='0:5~61'; spw 0, channels 5 to 61 00125 spw='0,10,3:3~45'; spw 0,10 all channels, spw 3 - chans 3 to 45. 00126 spw='0~2:2~6'; spw 0,1,2 with channels 2 through 6 in each. 00127 spw = '*:3~64' channels 3 through 64 for all sp id's 00128 spw = ' :3~64' will NOT work. 00129 spw = '*:0;60~63' channel 0 and channels 60 to 63 for all IFs 00130 ';' needed to separate different channel ranges in one spw 00131 spw='0:0~10;15~60'; spectral window 0 with channels 0-10,15-60 00132 spw='0:0~10,1:20~30,2:1;2;4'; spw 0, channels 0-10, 00133 spw 1, channels 20-30, and spw 2, channels, 1, 2 and 4 00134 00135 antenna -- Select data based on antenna/baseline 00136 default: '' (all) 00137 Non-negative integers are assumed to be antenna indices, and 00138 anything else is taken as an antenna name. 00139 00140 Examples: 00141 antenna='5&6': baseline between antenna index 5 and index 6. 00142 antenna='VA05&VA06': baseline between VLA antenna 5 and 6. 00143 antenna='5&6;7&8': baselines 5-6 and 7-8 00144 antenna='5': all baselines with antenna 5 00145 antenna='5,6,10': all baselines including antennas 5, 6, or 10 00146 antenna='5,6,10&': all baselines with *only* antennas 5, 6, or 00147 10. (cross-correlations only. Use && 00148 to include autocorrelations, and &&& 00149 to get only autocorrelations.) 00150 antenna='!ea03,ea12,ea17': all baselines except those that 00151 include EVLA antennas ea03, ea12, or 00152 ea17. 00153 00154 timebin -- Interval width for time averaging. 00155 default: '0s' or '-1s' (no averaging) 00156 Example: timebin='30s' 00157 '10' means '10s' 00158 00159 combine -- Let time bins span changes in scan and/or state. 00160 default = '' (separate time bins by both of the above) 00161 combine = 'scan': Can be useful when the scan number 00162 goes up with each integration, 00163 as in many WSRT MSes. 00164 combine = ['scan', 'state']: disregard scan and state 00165 numbers when time averaging. 00166 combine = 'state,scan': Same as above. 00167 00168 timerange -- Select data based on time range: 00169 default = '' (all); examples, 00170 timerange = 'YYYY/MM/DD/hh:mm:ss~YYYY/MM/DD/hh:mm:ss' 00171 Note: if YYYY/MM/DD is missing date, timerange defaults to the 00172 first day in the dataset 00173 timerange='09:14:0~09:54:0' picks 40 min on first day 00174 timerange='25:00:00~27:30:00' picks 1 hr to 3 hr 30min 00175 on next day 00176 timerange='09:44:00' data within one integration of time 00177 timerange='>10:24:00' data after this time 00178 00179 array -- (Sub)array number range 00180 default: ''=all 00181 00182 uvrange -- Select data within uvrange (default units meters) 00183 default: ''=all; example: 00184 uvrange='0~1000klambda'; uvrange from 0-1000 kilo-lambda 00185 uvrange='>4klambda';uvranges greater than 4 kilo-lambda 00186 uvrange='0~1000km'; uvrange in kilometers 00187 00188 scan -- Scan number range 00189 default: ''=all 00190 00191 observation -- Select by observation ID(s) 00192 default: ''=all 00193 00194 00195 00196 """ 00197 00198 # 00199 # The following is work around to avoid a bug with current python translation 00200 # 00201 mytmp = {} 00202 00203 mytmp['vis'] = vis 00204 mytmp['outputvis'] = outputvis 00205 mytmp['createmms'] = createmms 00206 mytmp['separationaxis'] = separationaxis 00207 mytmp['numsubms'] = numsubms 00208 mytmp['datacolumn'] = datacolumn 00209 mytmp['calmsselection'] = calmsselection 00210 mytmp['calmsname'] = calmsname 00211 mytmp['calfield'] = calfield 00212 mytmp['calscan'] = calscan 00213 mytmp['calintent'] = calintent 00214 mytmp['field'] = field 00215 mytmp['spw'] = spw 00216 mytmp['antenna'] = antenna 00217 mytmp['timebin'] = timebin 00218 mytmp['combine'] = combine 00219 mytmp['timerange'] = timerange 00220 mytmp['scan'] = scan 00221 mytmp['scanintent'] = scanintent 00222 mytmp['array'] = array 00223 mytmp['uvrange'] = uvrange 00224 mytmp['observation'] = observation 00225 pathname='file:///'+os.environ.get('CASAPATH').split()[0]+'/share/xml/' 00226 trec = casac.utils().torecord(pathname+'partition.xml') 00227 00228 casalog.origin('partition') 00229 if trec.has_key('partition') and casac.utils().verify(mytmp, trec['partition']) : 00230 result = task_partition.partition(vis, outputvis, createmms, separationaxis, numsubms, datacolumn, calmsselection, calmsname, calfield, calscan, calintent, field, spw, antenna, timebin, combine, timerange, scan, scanintent, array, uvrange, observation) 00231 00232 else : 00233 result = False 00234 return result