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_concat 00013 def concat(vis=[''], concatvis='', freqtol='', dirtol='', respectname=False, timesort=False, copypointing=True, visweightscale=[], createmms=False): 00014 00015 """Concatenate several visibility data sets. 00016 00017 The list of data sets given in the vis argument are concatenated into an output 00018 data set in concatvis. If concatvis already exists (e.g., it is the same as the 00019 first input data set), then the other input data sets will be appended to the 00020 concatvis data set. There is no limit to the number of input data sets. 00021 00022 If none of the input data sets have any scratch columns (model and corrected 00023 columns), none are created in the concatvis. Otherwise these columns are 00024 created on output and initialized to their default value (1 in model column, 00025 data in corrected column) for those data with no input columns. 00026 00027 Spectral windows for each data set with the same chanelization, and within a 00028 specified frequency tolerance of another data set will be combined into one 00029 spectral window. 00030 00031 A field position in one data set that is within a specified direction tolerance 00032 of another field position in any other data set will be combined into one 00033 field. The field names need not be the same---only their position is used. 00034 00035 Each appended dataset is assigned a new observation id. 00036 00037 Keyword arguments: 00038 vis -- Name of input visibility files to be combined 00039 default: none; example: vis = ['src2.ms','ngc5921.ms','ngc315.ms'] 00040 concatvis -- Name of visibility file that will contain the concatenated data 00041 note: if this file exits on disk then the input files are 00042 added to this file. Otherwise the new file contains 00043 the concatenated data. Be careful here when concatenating to 00044 an existing file. 00045 default: none; example: concatvis='src2.ms' 00046 example: concatvis='outvis.ms' 00047 00048 other examples: 00049 concat(vis=['src2.ms','ngc5921.ms'], concatvis='src2.ms') 00050 will concatenate 'ngc5921.ms' into 'src2.ms', and the original 00051 src2.ms is lost 00052 00053 concat(vis=['src2.ms','ngc5921.ms'], concatvis='out.ms') 00054 will concatenate 'ngc5921.ms' and 'src2.ms' into a file named 00055 'out.ms'; the original 'ngc5921.ms' and 'src2.ms' are untouched. 00056 00057 concat(vis=['v1.ms','v2.ms'], concatvis = 'vall.ms') 00058 then 00059 concat(vis=['v3.ms','v4.ms'], concatvis = 'vall.ms') 00060 vall.ms will contains v1.ms+v2.ms+v3.ms+v4.ms 00061 00062 Note: run flagmanager to save flags in the concatvis 00063 00064 freqtol -- Frequency shift tolerance for considering data to be in the same 00065 spwid. The number of channels must also be the same. 00066 default: '' do not combine unless frequencies are equal 00067 example: freqtol='10MHz' will not combine spwid unless they are 00068 within 10 MHz. 00069 Note: This option is useful to conbine spectral windows with very slight 00070 frequency differences caused by Doppler tracking, for example. 00071 00072 dirtol -- Direction shift tolerance for considering data as the same field 00073 default: '' means always combine. 00074 example: dirtol='1.arcsec' will not combine data for a field unless 00075 their phase center differ by less than 1 arcsec. If the field names 00076 are different in the input data sets, the name in the output data 00077 set will be the first relevant data set in the list. 00078 00079 respectname -- If true, fields with a different name are not merged even if their 00080 direction agrees (within dirtol) 00081 default: False 00082 00083 timesort -- If true, the output visibility table will be sorted in time. 00084 default: false. Data in order as read in. 00085 example: timesort=true 00086 Note: There is no constraint on data that is simultaneously observed for 00087 more than one field; for example multi-source correlation of VLBA data. 00088 00089 copypointing -- Make a proper copy of the POINTING subtable (can be time consuming). 00090 If False, the result is an empty POINTING table. 00091 default: True 00092 00093 visweightscale -- The weights of the individual MSs will be scaled in the concatenated 00094 output MS by the factors in this list. Useful for handling heterogeneous arrays. 00095 Use plotms to inspect the "Wt" column as a reference for determining the scaling 00096 factors. See the cookbook for more details. 00097 example: [1.,3.,3.] - scale the weights of the second and third MS by a factor 3. 00098 default: [] (empty list) - no scaling 00099 00100 createmms -- disabled. Please use task virtualconcat. 00101 default: False 00102 00103 00104 """ 00105 if type(vis)==str: vis=[vis] 00106 if type(visweightscale)==float: visweightscale=[visweightscale] 00107 00108 # 00109 # The following is work around to avoid a bug with current python translation 00110 # 00111 mytmp = {} 00112 00113 mytmp['vis'] = vis 00114 mytmp['concatvis'] = concatvis 00115 mytmp['freqtol'] = freqtol 00116 mytmp['dirtol'] = dirtol 00117 mytmp['respectname'] = respectname 00118 mytmp['timesort'] = timesort 00119 mytmp['copypointing'] = copypointing 00120 mytmp['visweightscale'] = visweightscale 00121 mytmp['createmms'] = createmms 00122 pathname='file:///'+os.environ.get('CASAPATH').split()[0]+'/share/xml/' 00123 trec = casac.utils().torecord(pathname+'concat.xml') 00124 00125 casalog.origin('concat') 00126 if trec.has_key('concat') and casac.utils().verify(mytmp, trec['concat']) : 00127 result = task_concat.concat(vis, concatvis, freqtol, dirtol, respectname, timesort, copypointing, visweightscale, createmms) 00128 00129 else : 00130 result = False 00131 return result