casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables
asdm-imexport+analysis.py
Go to the documentation of this file.
00001 # wrapper script for the ASDM import/export and analysis regression test
00002 import sys
00003 import os
00004 import string
00005 from locatescript import copydata
00006 from locatescript import locatescript
00007 import inspect
00008 
00009 # Short description
00010 def description():
00011     return "Test of the importasdm and exportasdm tasks, ASDM <-> MS data conversion, including simple analysis"
00012 
00013 pass_on = { "asdm_dataset_name" : "uid___X5f_X18951_X1",
00014             "ms_dataset_name" : "M51.ms",
00015             "asdm_dataset2_name" : 'uid___X02_X56142_X1',
00016             "wvr_correction_file" : 'N3256_B6_0.WVR'
00017             }
00018 
00019 a=inspect.stack()
00020 stacklevel=0
00021 for k in range(len(a)):
00022     if (string.find(a[k][1], 'ipython console') > 0):
00023         stacklevel=k
00024         break
00025 gl=sys._getframe(stacklevel).f_globals
00026 
00027 def data():
00028     ### return the data files that are needed by the regression script
00029     return [pass_on["asdm_dataset_name"],
00030             pass_on["ms_dataset_name"],
00031             pass_on["asdm_dataset2_name"],
00032             pass_on["wvr_correction_file"]
00033             ]
00034 
00035 def doCopy():
00036     ### return a list of the same length as that returned by data()
00037     ###   containing 0 if the corresponding file should be just linked
00038     ###   (i.e. is read-only)
00039     ###   or 1 if the corresponding file should be really copied to
00040     ###   the work directory
00041 
00042     return [0,0,0,0]
00043 
00044 def run( fetch=False ):
00045 
00046     #####fetch data
00047     if fetch:
00048         for f in data( ):
00049             copydata( f, os.getcwd( ) )
00050     
00051     #####locate the regression script
00052     try: 
00053         lepath=locatescript('alma_asdm+reimported-asdm_sf.py')
00054         print 'Script used is ',lepath
00055         execfile(lepath, gl, pass_on)
00056     except:
00057         print 'execution failed: ', sys.exc_info()
00058         raise
00059 ###return the images that will be templated and compared in future runs
00060     return []