casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables
regression.py
Go to the documentation of this file.
00001 ###############################
00002 # Regression 
00003 # 
00004 ###############################
00005 DO_G192                 = True
00006 DO_H121                 = True
00007 DO_L02D                 = True
00008 DO_NGC5921              = True
00009 DO_NGC7538              = True
00010 #----------
00011 DO_NGC1333              = True
00012 DO_NGC4826              = True
00013 #---------
00014 DO_NGC4826C             = True
00015 DO_ORION                = True
00016 #---------
00017 DO_B0319                = True
00018 #---------
00019 DO_ORI_SIO_TASK         = True
00020 DO_IRC_HC3N_TASK        = True
00021 DO_IRC_CS_TASK          = True
00022 DO_FLS3A_HI             = True
00023 #---------
00024 DO_COORDSYSTEST         = True
00025 DO_IMAGEPOLTEST         = True
00026 DO_IMAGETEST            = True
00027 #---------
00028 DO_IC2233               = False
00029 #---------
00030 DO_POINTING             = False
00031 #---------
00032 ###############################
00033 
00034 import time
00035 import os
00036 
00037 pathname=os.environ.get('CASAPATH').split()[0]
00038 libIndex=pathname.find('lib')
00039 
00040 if (libIndex !=-1):
00041     # Copy test scripts from an installed package directory. 
00042     scriptpath=pathname+'/lib/python2.6/regressions'
00043 else:
00044     # Copy test scripts from the source directory.
00045     scriptpath=pathname+'/gcwrap/python/scripts/regressions'
00046 
00047 command='cp '+scriptpath+'/*_regression.py .'
00048 #command='ls '+scriptpath+'/*_regression.py'
00049 
00050 os.system(command)
00051 
00052 import string
00053 import datetime
00054 datestring=datetime.datetime.isoformat(datetime.datetime.today())
00055 outfile='REGRESSION.'+datestring+'.log'
00056 regfile=open(outfile,'w')
00057 
00058 print >>regfile,''
00059 print >>regfile,'******** Report '
00060 print >>regfile,'         ------'
00061 #print >>regfile,'SOURCE \t PASSED  TIME \t\t RATE \t \t LOGFILE'
00062 print >>regfile,'%9s %6s %9s %9s %39s'%('SOURCE','PASSED','TIME','RATE','LOGFILE')
00063 
00064 scriptlist=['G192','H121','L02D','NGC5921','NGC7538','NGC1333','NGC4826','NGC4826C','ORION','B0319','ORI_SIO_TASK','IRC_HC3N_TASK','IRC_CS_TASK','FLS3A_HI','COORDSYSTEST', 'IMAGEPOLTEST', 'IMAGETEST', 'IC2233', 'POINTING']
00065 ratedict={'G192': 634.9,'H121': 500.,'L02D': 500.,'NGC5921': 35.1,'NGC7538': 240.3,'NGC1333': 500.,'NGC4826': 662.,'NGC4826C': 760., 'ORION': 500., 'B0319': 5.0,'ORI_SIO_TASK': 74,'IRC_HC3N_TASK': 694., 'IRC_CS_TASK': 694, 'FLS3A_HI':4100., 'COORDSYSTEST':44., 'IMAGEPOLTEST':41., 'IMAGETEST':32., 'IC2233':8051, 'POINTING':1080}
00066 
00067 for mysource in scriptlist:
00068     execute_script='DO_'+mysource
00069     if (eval(execute_script)):
00070         try:
00071             print 'source ',mysource
00072             execfile(str.lower(mysource)+'_regression.py')
00073             scriptpass=regstate
00074             scriptlog=outfile
00075             scripttime=(endTime-startTime)
00076             scriptrate=ratedict[mysource]/(endTime-startTime)
00077             print >>regfile,'%9s %6s %9s %9s %39s'%(mysource,scriptpass,scripttime,scriptrate,scriptlog)
00078         except:
00079             print 'Test failed:', sys.exc_info()[0]
00080 
00081 regfile.close()
00082