00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 import time
00020 import listing as lt
00021 import regression_utility as tstutl
00022
00023 startTime = time.time()
00024
00025 print "BEGIN: listvis_regression.py"
00026
00027 testPassed = 0
00028 testFailed = 0
00029 pathName = os.environ.get('CASAPATH').split()[0]
00030 automate = True
00031 regressionDir = 'listvis_regression'
00032 if (not os.path.exists(regressionDir)): os.mkdir(regressionDir)
00033
00034 if(automate):
00035 print "Running in automated mode."
00036 print " - All MS data will be rebuilt from scratch."
00037 print " - All test files will be removed after testing."
00038 else:
00039 print "Running in non-automated mode!"
00040
00041
00042
00043
00044
00045 def load_ngc4826(prefix,msname):
00046
00047
00048
00049 print "Removing files and directories: ngc4826.tutorial.*"
00050 os.system('rm -rf '+prefix+'ngc4826.tutorial.*')
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084 print '--Importuvfits (16apr98)--'
00085 default('importuvfits')
00086
00087 print "Starting from the uvfits files exported by miriad"
00088 print "The USB spectral windows were written separately by miriad for 16apr98"
00089
00090 pathName = os.environ.get('CASAPATH').split()[0]
00091 localData = pathName + '/data/regression/ngc4826/'
00092 importuvfits(fitsfile= localData + 'fitsfiles/3c273.fits5', vis=prefix+'ngc4826.tutorial.3c273.5.ms')
00093 importuvfits(fitsfile= localData + 'fitsfiles/3c273.fits6', vis=prefix+'ngc4826.tutorial.3c273.6.ms')
00094 importuvfits(fitsfile= localData + 'fitsfiles/3c273.fits7', vis=prefix+'ngc4826.tutorial.3c273.7.ms')
00095 importuvfits(fitsfile= localData + 'fitsfiles/3c273.fits8', vis=prefix+'ngc4826.tutorial.3c273.8.ms')
00096 importuvfits(fitsfile= localData + 'fitsfiles/1310+323.ll.fits9', vis=prefix+'ngc4826.tutorial.1310+323.ll.9.ms')
00097 importuvfits(fitsfile= localData + 'fitsfiles/1310+323.ll.fits10', vis=prefix+'ngc4826.tutorial.1310+323.ll.10.ms')
00098 importuvfits(fitsfile= localData + 'fitsfiles/1310+323.ll.fits11', vis=prefix+'ngc4826.tutorial.1310+323.ll.11.ms')
00099 importuvfits(fitsfile= localData + 'fitsfiles/1310+323.ll.fits12', vis=prefix+'ngc4826.tutorial.1310+323.ll.12.ms')
00100 importuvfits(fitsfile= localData + 'fitsfiles/1310+323.ll.fits13', vis=prefix+'ngc4826.tutorial.1310+323.ll.13.ms')
00101 importuvfits(fitsfile= localData + 'fitsfiles/1310+323.ll.fits14', vis=prefix+'ngc4826.tutorial.1310+323.ll.14.ms')
00102 importuvfits(fitsfile= localData + 'fitsfiles/1310+323.ll.fits15', vis=prefix+'ngc4826.tutorial.1310+323.ll.15.ms')
00103 importuvfits(fitsfile= localData + 'fitsfiles/1310+323.ll.fits16', vis=prefix+'ngc4826.tutorial.1310+323.ll.16.ms')
00104 importuvfits(fitsfile= localData + 'fitsfiles/ngc4826.ll.fits5', vis=prefix+'ngc4826.tutorial.ngc4826.ll.5.ms')
00105 importuvfits(fitsfile= localData + 'fitsfiles/ngc4826.ll.fits6', vis=prefix+'ngc4826.tutorial.ngc4826.ll.6.ms')
00106 importuvfits(fitsfile= localData + 'fitsfiles/ngc4826.ll.fits7', vis=prefix+'ngc4826.tutorial.ngc4826.ll.7.ms')
00107 importuvfits(fitsfile= localData + 'fitsfiles/ngc4826.ll.fits8', vis=prefix+'ngc4826.tutorial.ngc4826.ll.8.ms')
00108
00109
00110
00111 print '--Concat--'
00112 default('concat')
00113 concat(vis=[prefix+'ngc4826.tutorial.3c273.5.ms',
00114 prefix+'ngc4826.tutorial.3c273.6.ms',
00115 prefix+'ngc4826.tutorial.3c273.7.ms',
00116 prefix+'ngc4826.tutorial.3c273.8.ms',
00117 prefix+'ngc4826.tutorial.1310+323.ll.9.ms',
00118 prefix+'ngc4826.tutorial.1310+323.ll.10.ms',
00119 prefix+'ngc4826.tutorial.1310+323.ll.11.ms',
00120 prefix+'ngc4826.tutorial.1310+323.ll.12.ms',
00121 prefix+'ngc4826.tutorial.1310+323.ll.13.ms',
00122 prefix+'ngc4826.tutorial.1310+323.ll.14.ms',
00123 prefix+'ngc4826.tutorial.1310+323.ll.15.ms',
00124 prefix+'ngc4826.tutorial.1310+323.ll.16.ms',
00125 prefix+'ngc4826.tutorial.ngc4826.ll.5.ms',
00126 prefix+'ngc4826.tutorial.ngc4826.ll.6.ms',
00127 prefix+'ngc4826.tutorial.ngc4826.ll.7.ms',
00128 prefix+'ngc4826.tutorial.ngc4826.ll.8.ms'],
00129 concatvis=msname,
00130 freqtol="",dirtol="1arcsec",async=False)
00131
00132
00133
00134 def load_jupiter6cm(prefix,msname):
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152 os.system('rm -rf '+prefix+'*')
00153
00154 msfile = msname
00155
00156
00157 pathname=os.environ.get('CASAPATH').split()[0]
00158
00159 fitsdata=pathname+'/data/regression/jupiter6cm/jupiter6cm.fits'
00160
00161
00162
00163
00164 print '--Import--'
00165 print "Use importuvfits to read UVFITS and make an MS"
00166
00167 print "MS will be called "+msfile
00168
00169 importuvfits(fitsfile=fitsdata,vis=msfile)
00170
00171
00172
00173
00174 testNum = 0
00175
00176
00177
00178
00179
00180
00181 testNum += 1
00182 print ""
00183 print "* TEST " + str(testNum) + ": using ngc4826 tutorial data"
00184 print ""
00185
00186 prefix = regressionDir+'/test'+str(testNum)+'/'
00187 msname = prefix+"ngc4826.tutorial.ms"
00188 outputFilename = prefix+'listvis.ngc4826.short.out'
00189 localData = pathName + '/data/regression/ngc4826/'
00190 standardFilename = localData+'listvis.short.out'
00191
00192
00193 if (not lt.resetData([msname], automate)):
00194 print "Using preexisting data."
00195 lt.removeOut(outputFilename)
00196 else:
00197 print "Building data from scratch."
00198 tstutl.maketestdir(prefix)
00199 load_ngc4826(prefix,msname)
00200
00201
00202 default(listvis)
00203 vis = msname
00204 options = 'ap'
00205 datacolumn = 'data'
00206 field = ''
00207 spw = '0~1:0~9'
00208 selectdata = True
00209 antenna = '6&7'
00210 timerange = '<03:33:48'
00211 correlation = ''
00212 scan = ''
00213 feed = ''
00214 array = ''
00215 uvrange = ''
00216 average = ''
00217 showflags = False
00218 pagerows = 20
00219 listfile = outputFilename
00220 async = False
00221 go(listvis)
00222
00223 comparefilename = prefix + 'compare_' + str(testNum)
00224 if (lt.runTests(outputFilename,standardFilename,'1.000',comparefilename)):
00225 print "passed listvis output test"
00226 testPassed +=1
00227 else:
00228 print "failed listvis output test"
00229 testFailed +=1
00230
00231
00232
00233
00234
00235 testNum += 1
00236 print ""
00237 print "* TEST " + str(testNum) + ": default test; using ngc4826 tutorial data."
00238 print """
00239 - Using default input values, except for 'vis' and 'listfile'.
00240 - This data has multiple spws with variable numbers of channels.
00241 *** listvis does not handle this data appropriately. ***
00242 *** WARNing messages will be sent to the logger. ***
00243 *** This is a known issue. The test should still pass. ***
00244
00245 """
00246
00247 prefix = regressionDir+'/test'+str(testNum)+'/'
00248 outputFilename = prefix + 'listvis.ngc4826.default.out'
00249 standardFilename = localData+'listvis.default.out'
00250
00251 tstutl.maketestdir(prefix)
00252 if (not lt.resetData([msname], automate)):
00253 print "Using data from test 1."
00254 else:
00255 print "Building data from scratch."
00256 msname = prefix+"ngc4826.tutorial.ms"
00257 load_ngc4826(prefix,msname)
00258
00259 default(listvis)
00260 vis = msname
00261 spw = '0'
00262 listfile = outputFilename
00263 go(listvis)
00264
00265 comparefilename = prefix + 'compare_' + str(testNum)
00266 if (lt.runTests(outputFilename,standardFilename,'1.000',comparefilename)):
00267 print "passed listvis output test"
00268 testPassed +=1
00269 else:
00270 print "failed listvis output test"
00271 testFailed +=1
00272
00273
00274
00275
00276
00277 testNum += 1
00278 print ""
00279 print "* TEST " + str(testNum) + ": jupiter 6cm test, use all available parameters"
00280 print ""
00281
00282 prefix = regressionDir+'/test'+str(testNum)+'/'
00283 msname = prefix+"jupiter6cm.demo.ms"
00284 outputFilename = prefix+'listvis.jupiter6cm.nondefault.out'
00285 localData = pathName + '/data/regression/jupiter6cm/'
00286 standardFilename = localData+'listvis.nondefault.out'
00287
00288
00289 if (not lt.resetData([msname], automate)):
00290 print "Using preexisting data."
00291 lt.removeOut(outputFilename)
00292 else:
00293 print "Building data from scratch."
00294 tstutl.maketestdir(prefix)
00295 load_jupiter6cm(prefix,msname)
00296
00297 default(listvis)
00298 vis = msname
00299 options = 'ap'
00300 datacolumn = 'data'
00301 field = '12'
00302 spw = '0'
00303 selectdata = True
00304 antenna = '16&22'
00305 timerange = '<1999/04/16/18:31:36.6'
00306 correlation = 'LL LR RR'
00307 scan = '76'
00308 feed = ''
00309 array = ''
00310 uvrange = ''
00311 average = ''
00312 showflags = False
00313 pagerows = 5
00314 listfile = outputFilename
00315 async = False
00316 go(listvis)
00317
00318 comparefilename = prefix + 'compare_' + str(testNum)
00319 if (lt.runTests(outputFilename,standardFilename,'1.000',comparefilename)):
00320 print "passed listvis output test"
00321 testPassed +=1
00322 else:
00323 print "failed listvis output test"
00324 testFailed +=1
00325
00326
00327
00328
00329
00330
00331
00332 testNum += 1
00333 print ""
00334 print "* TEST " + str(testNum) + ": jupiter 6cm data, mostly defaults"
00335 print ""
00336
00337 prefix = regressionDir+'/test'+str(testNum)+'/'
00338 outputFilename = prefix + 'listvis.jupiter6cm.default.out'
00339 standardFilename = localData+'listvis.default.out'
00340
00341 tstutl.maketestdir(prefix)
00342
00343 if (not lt.resetData([msname], automate)):
00344 print "Using data from previous test."
00345 else:
00346 print "Building data from scratch."
00347 msname = prefix+"jupiter6cm.demo.ms"
00348 load_jupiter6cm(prefix,msname)
00349
00350 default(listvis)
00351 vis = msname
00352 selectdata = True
00353 scan = '76'
00354 listfile = outputFilename
00355 go(listvis)
00356
00357 comparefilename = prefix + 'compare_' + str(testNum)
00358 if (lt.runTests(outputFilename,standardFilename,'1.000',comparefilename)):
00359 print "passed listvis output test"
00360 testPassed +=1
00361 else:
00362 print "failed listvis output test"
00363 testFailed +=1
00364
00365
00366
00367
00368
00369
00370 testNum += 1
00371 print ""
00372 print "* TEST " + str(testNum) + ": using single dish data OrionS_rawACSmod"
00373 print ""
00374
00375 prefix = regressionDir+'/test'+str(testNum)+'/'
00376 msname = prefix+"OrionS_rawACSmod"
00377 outputFilename = prefix+'listvis.orion.short.out'
00378 localData = pathName + '/data/regression/ATST5/OrionS/'
00379 standardFilename = localData+'listvis.orionshort.out'
00380
00381
00382 if (not lt.resetData([msname], automate)):
00383 print "Using preexisting data."
00384 lt.removeOut(outputFilename)
00385 else:
00386 print "Building data from scratch."
00387 tstutl.maketestdir(prefix)
00388 shutil.copytree(localData+'OrionS_rawACSmod', msname)
00389
00390
00391 default(listvis)
00392 vis = msname
00393 options = 'ap'
00394 datacolumn = 'float_data'
00395 field = ''
00396 spw = '0:1200~1205'
00397 selectdata = True
00398 showflags = False
00399 pagerows = 20
00400 listfile = outputFilename
00401 async = False
00402 go(listvis)
00403
00404 comparefilename = prefix + 'compare_' + str(testNum)
00405 if (lt.runTests(outputFilename,standardFilename,'1.000',comparefilename)):
00406 print "passed listvis output test"
00407 testPassed +=1
00408 else:
00409 print "failed listvis output test"
00410 testFailed +=1
00411
00412
00413
00414
00415
00416 print ""
00417 print "* listvis regression test complete"
00418 print "SUMMARY:"
00419 print " number of tests PASSED: " + str(testPassed)
00420 print " number of tests FAILED: " + str(testFailed)
00421 print ""
00422
00423 if testFailed > 0:
00424 print ''
00425 print 'Regression FAILED'
00426 print ''
00427 else:
00428 print ''
00429 print 'Regression PASSED'
00430 print ''
00431
00432 print "END: listvis_regression.py"
00433
00434 if (testFailed > 0):
00435 regstate = False
00436 else:
00437 regstate = True
00438
00439 endTime = time.time()