00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 import time
00011 import os
00012
00013 os.system('rm -rf FLS3a_HI.image FLS3a_HI.asap FLS3b_HI.asap FLS3a_calfs')
00014
00015 casapath=os.environ['CASAPATH'].split()[0]
00016 datapath=casapath+'/data/regression/ATST5/FLS3/FLS3_all_newcal_SP'
00017
00018
00019
00020 startTime=time.time()
00021 startProc=time.clock()
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 casapath=os.environ['CASAPATH']
00054 import asap as sd
00055 os.environ['CASAPATH']=casapath
00056
00057 print '--Import--'
00058
00059 storage_sav=sd.rcParams['scantable.storage']
00060 sd.rc('scantable',storage='disk')
00061
00062 s=sd.scantable(datapath,average=false,getpt=false)
00063
00064 importproc=time.clock()
00065 importtime=time.time()
00066
00067 print '--Split & Save--'
00068
00069 s0=s.get_scan('FLS3a*')
00070 s0.save('FLS3a_HI.asap')
00071 del s
00072 del s0
00073 splitproc=time.clock()
00074 splittime=time.time()
00075
00076 print '--Calibrate--'
00077 s=sd.scantable('FLS3a_HI.asap',average=False)
00078 s.set_fluxunit('K')
00079
00080 scanns = s.getscannos()
00081 sn=list(scanns)
00082 print "No. scans to be processed:", len(scanns)
00083 res=sd.calfs(s,sn)
00084 del s
00085 calproc=time.clock()
00086 caltime=time.time()
00087
00088 print '--Save calibrated data--'
00089 res.save('FLS3a_calfs', 'MS2')
00090 del res
00091 saveproc=time.clock()
00092 savetime=time.time()
00093
00094 print '--Image data--'
00095
00096 im.open('FLS3a_calfs')
00097 im.selectvis(nchan=901,start=30,step=1,
00098 spw=0,field=0)
00099 dir='J2000 17:18:29 +59.31.23'
00100 im.defineimage(nx=150,cellx='1.5arcmin',
00101 phasecenter=dir,mode='channel',start=30,
00102 nchan=901,step=1)
00103
00104
00105 im.setoptions(ftmachine='sd',cache=1000000000)
00106 im.setsdoptions(convsupport=4)
00107
00108 im.makeimage(type='singledish',image='FLS3a_HI.image')
00109 imagetime=time.time()
00110 im.close()
00111
00112
00113
00114 imageproc=time.clock()
00115 imagetime = time.time()
00116
00117
00118 endProc = imageproc
00119 endTime = imagetime
00120
00121
00122
00123
00124 ia.open('FLS3a_HI.image')
00125 statistics=ia.statistics()
00126 thistest_immax=statistics['max'][0]
00127 thistest_imrms=statistics['rms'][0]
00128
00129
00130
00131
00132
00133
00134 hi_max=25.58
00135 hi_rms=1.014
00136
00137 diff_immax=abs((hi_max-thistest_immax)/hi_max)
00138 diff_imrms=abs((hi_rms-thistest_imrms)/hi_rms)
00139
00140 import datetime
00141 datestring=datetime.datetime.isoformat(datetime.datetime.today())
00142 outfile='fls3a.hi.'+datestring+'.log'
00143 logfile=open(outfile,'w')
00144
00145
00146 print >>logfile,''
00147 print >>logfile,'********** Regression ***********'
00148 print >>logfile,'* *'
00149 if (diff_immax < 0.05): print '* Passed image max test '
00150 print >>logfile,'* Image max ',thistest_immax
00151 if (diff_imrms < 0.05): print '* Passed image rms test '
00152 print >>logfile,'* Image rms ',thistest_imrms
00153 if ((diff_immax<0.05) & (diff_imrms<0.05)):
00154 regstate=True
00155 print >>logfile,'---'
00156 print >>logfile,'Passed Regression test for FLS3a HI'
00157 print >>logfile,'---'
00158 print ''
00159 print 'Regression PASSED'
00160 print ''
00161 else:
00162 regstate=False
00163 print ''
00164 print 'Regression FAILED'
00165 print ''
00166 print >>logfile,'----FAILED Regression test for FLS3a HI'
00167 print >>logfile,'*********************************'
00168
00169 print >>logfile,''
00170 print >>logfile,''
00171 print >>logfile,'********* Benchmarking *****************'
00172 print >>logfile,'* *'
00173 print >>logfile,'Total wall clock time was: '+str(endTime - startTime)
00174 print >>logfile,'Total CPU time was: '+str(endProc - startProc)
00175 print >>logfile,'Processing rate MB/s was: '+str(4100/(endTime - startTime))
00176 print >>logfile,'* Breakdown: '
00177 print >>logfile,'* import time was: '+str(importtime-startTime)
00178 print >>logfile,'* CPU time was: '+str(importproc-startProc)
00179 print >>logfile,'* split time was: '+str(splittime-importtime)
00180 print >>logfile,'* CPU time was: '+str(splitproc-importproc)
00181 print >>logfile,'* calibration time was: '+str(caltime-splittime)
00182 print >>logfile,'* CPU time was: '+str(calproc-splitproc)
00183 print >>logfile,'* save time was: '+str(savetime-caltime)
00184 print >>logfile,'* CPU time was: '+str(saveproc-calproc)
00185 print >>logfile,'* image time was: '+str(imagetime-savetime)
00186 print >>logfile,'* CPU time was: '+str(imageproc-saveproc)
00187 print >>logfile,'****************************************'
00188
00189
00190 logfile.close()
00191
00192 sd.rc('scantable',storage=storage_sav)