Go to the documentation of this file.00001 import os
00002 import time
00003
00004
00005
00006 benchmarking = True
00007 usedasync = False
00008
00009
00010
00011
00012
00013 pathname=os.environ.get('CASAPATH').split()[0]
00014
00015
00016 fitsdata=pathname+'/data/demo/3DDAT.fits'
00017
00018 os.system('rm -rf n3ddat*')
00019
00020
00021 if benchmarking:
00022 startTime = time.time()
00023 startProc = time.clock()
00024
00025
00026
00027
00028
00029
00030 print '--Import--'
00031
00032
00033 default('importuvfits')
00034
00035 prefix='n3ddat'
00036
00037 msfile = prefix + '.ms'
00038
00039
00040 fitsfile = fitsdata
00041 vis = msfile
00042 antnamescheme = 'new'
00043 importuvfits()
00044
00045
00046
00047
00048
00049 if benchmarking:
00050 importtime = time.time()
00051
00052 tflagdata(vis=msfile, mode='manual', antenna='VA10', spw='*', field='0')
00053
00054 print '--Widefield--'
00055 default('widefield')
00056
00057
00058 vis = msfile
00059
00060
00061 imname = prefix + '.clean'
00062 imagename = imname
00063
00064
00065 mode = 'mfs'
00066
00067
00068
00069 field = '0'
00070 spw = '*'
00071
00072 selectdata=True
00073
00074
00075 gain = 0.1
00076
00077
00078 imsize = [3000,3000]
00079
00080
00081 psfmode = 'clark'
00082
00083 cell = ['30arcsec','30arcsec']
00084
00085
00086 niter = 6000
00087
00088
00089 threshold=0.0
00090
00091
00092 weighting = 'natural'
00093
00094
00095 ftmachine='wproject'
00096 wprojplanes=200
00097 cyclefactor=3
00098
00099
00100 mask = ''
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110 widefield()
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130 clnimage = imname+'.image'
00131
00132
00133 if benchmarking:
00134 cleantime = time.time()
00135
00136 print '--Imstat--'
00137 default('imstat')
00138
00139 imagename = clnimage
00140
00141 cubestats =imstat()
00142
00143
00144
00145
00146
00147
00148
00149
00150 print ""
00151 print ' 3DDAT results '
00152 print ' =============== '
00153
00154 print ''
00155 print ' --Regression Tests--'
00156 print ''
00157
00158
00159 thistest_immax=cubestats['max'][0]
00160 oldtest_immax = 7.50
00161 print ' Clean image max should be ',oldtest_immax
00162 print ' Found : Image Max = ',thistest_immax
00163 diff_immax = abs((oldtest_immax-thistest_immax)/oldtest_immax)
00164 print ' Difference (fractional) = ',diff_immax
00165
00166 print ''
00167
00168 thistest_imrms=cubestats['rms'][0]
00169 oldtest_imrms = 0.134
00170 print ' Clean image rms should be ',oldtest_imrms
00171 print ' Found : Image rms = ',thistest_imrms
00172 diff_imrms = abs((oldtest_imrms-thistest_imrms)/oldtest_imrms)
00173 print ' Difference (fractional) = ',diff_imrms
00174
00175
00176
00177
00178 if benchmarking:
00179 endProc = time.clock()
00180 endTime = time.time()
00181
00182
00183
00184
00185 if not benchmarking:
00186 print ''
00187 print '--- Done ---'
00188 else:
00189 import datetime
00190 datestring=datetime.datetime.isoformat(datetime.datetime.today())
00191 outfile='wproj3ddat.'+datestring+'.log'
00192 logfile=open(outfile,'w')
00193
00194 print >>logfile,''
00195 print >>logfile,''
00196
00197
00198 if (diff_immax < 0.05):
00199 passimmax = True
00200 print >>logfile,'* Passed image max test'
00201 else:
00202 passimmax = False
00203 print >>logfile,'* FAILED image max test'
00204 print >>logfile,'* Image max '+str(thistest_immax)
00205
00206 if (diff_imrms < 0.05):
00207 passimrms = True
00208 print >>logfile,'* Passed image rms test'
00209 else:
00210 passimrms = False
00211 print >>logfile,'* FAILED image rms test'
00212 print >>logfile,'* Image rms '+str(thistest_imrms)
00213
00214 if (passimmax and passimrms ):
00215 regstate=True
00216 print >>logfile,'---'
00217 print >>logfile,'Passed Regression test for wproj3ddat'
00218 print >>logfile,'---'
00219 else:
00220 regstate=False
00221 print >>logfile,'---'
00222 print >>logfile,'FAILED Regression test for wproj3ddat'
00223 print >>logfile,'---'
00224 print >>logfile,'*********************************'
00225
00226 print >>logfile,''
00227 print >>logfile,''
00228 print >>logfile,'********* Benchmarking *****************'
00229 print >>logfile,'* *'
00230 print >>logfile,'Total wall clock time was: ', endTime - startTime
00231 print >>logfile,'Total CPU time was: ', endProc - startProc
00232 print >>logfile,'Processing rate MB/s was: ', 35.1/(endTime - startTime)
00233 print >>logfile,'* Breakdown: *'
00234 print >>logfile,'* import time was: '+str(importtime-startTime)
00235 print >>logfile,'* clean time was: '+str(cleantime-importtime)
00236 print >>logfile,'*****************************************'
00237 print >>logfile,'basho (test cpu) time was: ?? seconds'
00238
00239 logfile.close()
00240
00241 print ""
00242 print "Done!"
00243
00244
00245
00246