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_importasdm 00013 def importasdm(asdm='', vis='', singledish=False, antenna=0, corr_mode='all', srt='all', time_sampling='all', ocorr_mode='ca', compression=False, asis='', wvr_corrected_data='no', scans='', ignore_time=False, process_syspower=True, process_caldevice=True, process_pointing=True, process_flags=True, tbuff=0.0, applyflags=False, savecmds=True, outfile='', verbose=False, overwrite=False, showversion=False, useversion='v3'): 00014 00015 """Convert an ALMA Science Data Model observation into a CASA visibility file (MS) or single-dish data format (Scantable) 00016 Keyword arguments: 00017 asdm -- Name of input ASDM file (directory) 00018 default: none; example: asdm='ExecBlock3' 00019 00020 vis -- Root ms or scantable name, note a prefix (.ms or .asap) is NOT appended to this name 00021 default: none 00022 00023 singledish -- Set True to write data as single-dish format (Scantable) 00024 default: False 00025 00026 >>> singledish expandable parameter 00027 antenna -- antenna name or id. 00028 00029 corr_mode -- correlation mode to be considered on input. Could 00030 be one or more of the following, ao, co, ac, or all 00031 default: 'all' 00032 00033 srt -- spectral resolution type. Could be one or more of 00034 the following, fr, ca, bw, or all 00035 default: 'all' 00036 00037 time_sampling -- specifies the time sampling, INTEGRATION and/or 00038 SUBINTEGRAION. could be one or more of the following 00039 i, si, or all. 00040 default: 'all' 00041 00042 ocorr_mode -- output data for correlation mode AUTO_ONLY 00043 (ao) or CROSS_ONLY (co) or CROSS_AND_AUTO (ca) 00044 default: 'ca' 00045 00046 00047 compression -- produces comrpressed columns in the resulting measurement set. 00048 default: False 00049 00050 00051 asis -- creates verbatim copies of the ASDM tables in 00052 the output measurement set. The value given to 00053 this option must be a list of table names separated 00054 by space characters; the wildcard character '*' is 00055 allowed in table names. 00056 default: none 00057 00058 wvr_corrected_data -- specifies wich values are considered in the 00059 ASDM binary data to fill the DATA column in 00060 the MAIN table of the MS. Expected values for 00061 this option are 'no' for the uncorrected data 00062 (this is the default), 'yes' for the corrected 00063 data and 'both' for corrected and uncorrected 00064 data. In the latter case, two measurement sets 00065 are created, one containing the uncorrected 00066 data and the other one, whose name is suffixed 00067 by '-wvr-corrected', containing the corrected 00068 data. 00069 default: 'no' 00070 00071 scans -- processes only the scans specified in the option's value. This value is a semicolon 00072 separated list of scan specifications. A scan specification consists in an exec bock index 00073 followed by the character ':' followed by a comma separated list of scan indexes or scan 00074 index ranges. A scan index is relative to the exec block it belongs to. Scan indexes are 00075 1-based while exec blocks's are 0-based. '0:1' or '2:2~6' or '0:1,1:2~6,8;2:,3:24~30' '1,2' 00076 are valid values for the option. '3:' alone will be interpreted as 'all the scans of the 00077 exec block#3'. An scan index or a scan index range not preceded by an exec block index will 00078 be interpreted as 'all the scans with such indexes in all the exec blocks'. By default 00079 all the scans are considered. 00080 default: none (all scans) 00081 00082 ignore_time -- All the rows of the tables Feed, History, Pointing, Source, SysCal, CalDevice, SysPower, 00083 and Weather are processed independently of the time range of the selected exec block / scan. 00084 default: False 00085 00086 process_syspower -- The SysPower table is processed if and only if this parameter is set to True. 00087 default: True 00088 00089 process_caldevice -- The CalDevice table is processed if and only if this parameter is set to True. 00090 default: True 00091 00092 process_pointing -- The Pointing table is processed if and only if this parameter is set to True. 00093 default: True 00094 00095 process_flags -- Create online flags based on the Flag.xml, Antenna.xml and SpectralWindow.xml files 00096 and copy them to the FLAG_CMD sub-table of the MS. The flags will NOT be applied unless 00097 the parameter applyflags is set to True. Optionally, the flags can also be saved to 00098 an external ASCII file if savecmds is set to True. 00099 default: True 00100 00101 >>> process_flags expandable parameter 00102 tbuff -- Time padding buffer (in seconds) 00103 default: 0.0 00104 00105 NOTE: this time is in seconds. You should currently 00106 set the value of tbuff to be 1.5x the correlator 00107 integration time if greater than 1 second. For 00108 example, if the SDM has integrations of 3 seconds, 00109 set tbuff=4.5. Likewise, set tbuff=15.0 for 10-sec 00110 integrations. 00111 00112 applyflags -- Apply the online flags to the MS. 00113 default: False 00114 00115 00116 savecmds -- Save the flag commands to an ASCII file given by the parameter outfile. 00117 default: False 00118 00119 outfile -- Filename where to save the flag commands. 00120 default: ' ' --> by default it will save on a filename composed from the MS name. 00121 Example: vis='uid_A02.ms', the outfile will be 'uid_A02_cmd.txt'. 00122 00123 NOTE: The file is open to save in append mode. 00124 00125 00126 verbose -- produce log output as asdm2MS is being run 00127 default: False 00128 00129 showversion -- report the version of the asdm2MS being used. 00130 default: False 00131 00132 useversion -- Selects the version of asdm2MS to be used (\'v3\' (default, should work for all data)) 00133 default: v3 00134 00135 00136 """ 00137 00138 # 00139 # The following is work around to avoid a bug with current python translation 00140 # 00141 mytmp = {} 00142 00143 mytmp['asdm'] = asdm 00144 mytmp['vis'] = vis 00145 mytmp['singledish'] = singledish 00146 mytmp['antenna'] = antenna 00147 mytmp['corr_mode'] = corr_mode 00148 mytmp['srt'] = srt 00149 mytmp['time_sampling'] = time_sampling 00150 mytmp['ocorr_mode'] = ocorr_mode 00151 mytmp['compression'] = compression 00152 mytmp['asis'] = asis 00153 mytmp['wvr_corrected_data'] = wvr_corrected_data 00154 mytmp['scans'] = scans 00155 mytmp['ignore_time'] = ignore_time 00156 mytmp['process_syspower'] = process_syspower 00157 mytmp['process_caldevice'] = process_caldevice 00158 mytmp['process_pointing'] = process_pointing 00159 mytmp['process_flags'] = process_flags 00160 mytmp['tbuff'] = tbuff 00161 mytmp['applyflags'] = applyflags 00162 mytmp['savecmds'] = savecmds 00163 mytmp['outfile'] = outfile 00164 mytmp['verbose'] = verbose 00165 mytmp['overwrite'] = overwrite 00166 mytmp['showversion'] = showversion 00167 mytmp['useversion'] = useversion 00168 pathname='file:///'+os.environ.get('CASAPATH').split()[0]+'/share/xml/' 00169 trec = casac.utils().torecord(pathname+'importasdm.xml') 00170 00171 casalog.origin('importasdm') 00172 if trec.has_key('importasdm') and casac.utils().verify(mytmp, trec['importasdm']) : 00173 result = task_importasdm.importasdm(asdm, vis, singledish, antenna, corr_mode, srt, time_sampling, ocorr_mode, compression, asis, wvr_corrected_data, scans, ignore_time, process_syspower, process_caldevice, process_pointing, process_flags, tbuff, applyflags, savecmds, outfile, verbose, overwrite, showversion, useversion) 00174 00175 else : 00176 result = False 00177 return result