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_exportasdm 00013 def exportasdm(vis='', asdm='', datacolumn='data', archiveid='S0', rangeid='X1', subscanduration='24h', sbduration='2700s', apcorrected=True, verbose=True, showversion=True, useversion='v3'): 00014 00015 """Convert a CASA visibility file (MS) into an ALMA Science Data Model 00016 00017 Keyword arguments: 00018 vis -- MS name, 00019 default: none 00020 00021 asdm -- Name of output ASDM file (directory), 00022 default: none; example: asdm='ExecBlock3' 00023 00024 datacolumn -- specifies which of the MS data columns (data, 00025 corrected, or model) should be used as the 00026 visibilities in the ASDM, default: data 00027 00028 archiveid -- the X0 in uid://X0/X1/X<running> 00029 default: "S0" 00030 00031 rangeid -- the X1 in uid://X0/X1/X<running> 00032 default: "X1" 00033 00034 subscanduration -- maximum duration of a subscan in the output ASDM 00035 default: "24h" 00036 00037 sbduration -- maximum duration of a scheduling block in the output ASDM 00038 default: "2700s" 00039 00040 apcorrected -- If true, the data in column datacolumn will be marked 00041 as having atmospheric phase correction, default: True 00042 00043 verbose -- produce log output, default: True 00044 00045 showversion -- report the version of the ASDM class set, 00046 default: True 00047 00048 useversion -- Selects the version of MS2asdm to be used (\'v3\' (default) or \'v2\' (version before May 2011)) 00049 default: v3 00050 00051 exportasdm(vis='ngc4826.ms', asdm='uid___S021_X1418_X1', 00052 datacolumn='corrected', archiveid='S021', rangeid='X1418', 00053 verbose=False) 00054 will produce an ASDM named 'uid___S021_X1418_X1' using the 00055 datacolumn 'corrected' in the MS 'ngc4826.ms' with minimal 00056 log output. 00057 00058 Note concerning ALMA data: exportasdm presently is not able to export 00059 from MSs containing WVR data. If you attempt to export such an MS, you 00060 will receive an error message saying that you can only export data of 00061 processor type "CORRELATOR". It will also give you the list of SPWs 00062 which contain CORRELATOR data. You will then have to split out these 00063 SPWs using the task "split" and run exportasdm on the resulting MS. 00064 00065 00066 """ 00067 00068 # 00069 # The following is work around to avoid a bug with current python translation 00070 # 00071 mytmp = {} 00072 00073 mytmp['vis'] = vis 00074 mytmp['asdm'] = asdm 00075 mytmp['datacolumn'] = datacolumn 00076 mytmp['archiveid'] = archiveid 00077 mytmp['rangeid'] = rangeid 00078 mytmp['subscanduration'] = subscanduration 00079 mytmp['sbduration'] = sbduration 00080 mytmp['apcorrected'] = apcorrected 00081 mytmp['verbose'] = verbose 00082 mytmp['showversion'] = showversion 00083 mytmp['useversion'] = useversion 00084 pathname='file:///'+os.environ.get('CASAPATH').split()[0]+'/share/xml/' 00085 trec = casac.utils().torecord(pathname+'exportasdm.xml') 00086 00087 casalog.origin('exportasdm') 00088 if trec.has_key('exportasdm') and casac.utils().verify(mytmp, trec['exportasdm']) : 00089 result = task_exportasdm.exportasdm(vis, asdm, datacolumn, archiveid, rangeid, subscanduration, sbduration, apcorrected, verbose, showversion, useversion) 00090 00091 else : 00092 result = False 00093 return result