00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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 import os
00054 import regression_utility as tstutl
00055 from __main__ import default
00056 from tasks import *
00057 from taskinit import *
00058
00059
00060
00061 regstate=True
00062
00063
00064
00065
00066
00067 fitsdata='3C219D_CAL.UVFITS'
00068 rgnmask='rgn3C219D.rgn'
00069
00070
00071 testdir='3C219D_regression/'
00072
00073
00074 prefix=testdir+'3C219D'
00075 tmpfile = prefix+'temp.ms'
00076 msfile=prefix+'.ms'
00077
00078
00079
00080 tstutl.maketestdir(testdir)
00081
00082 ''' Version with breakpoints. It will raise an Exception if any task fails.'''
00083
00084
00085
00086
00087
00088
00089
00090 print '--Importuvfits--'
00091 status = True
00092 taskname = 'importuvfits'
00093 default(taskname)
00094 fitsfile = fitsdata
00095 vis=tmpfile
00096 antnamescheme = 'new'
00097 status = importuvfits()
00098
00099 if status == False:
00100 regstate=False
00101 raise Exception, "Regression test failed for 3C219D in task \"%s\"" %(taskname)
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111 print '--Listobs--'
00112 status = True
00113 taskname = 'listobs'
00114 default(taskname)
00115 vis=tmpfile
00116 status = listobs()
00117
00118 if status == False:
00119 regstate=False
00120 raise Exception, "Regression test failed for 3C219D in task \"%s\"" %(taskname)
00121
00122
00123
00124
00125
00126
00127 print '--Fixvis--'
00128 status = True
00129 taskname = 'fixvis'
00130 default (taskname)
00131 vis = tmpfile
00132 outputvis = msfile
00133 refcode = 'J2000'
00134 status = fixvis()
00135
00136 if status == False:
00137 regstate=False
00138 raise Exception, "Regression test failed for 3C219D in task \"%s\"" %(taskname)
00139
00140
00141
00142
00143
00144
00145 print '--Vishead--'
00146 taskname = 'vishead'
00147 default (vishead)
00148 mode = 'list'
00149 listitems = []
00150 vis = tmpfile
00151 a=vishead()
00152 vis = msfile
00153 b=vishead()
00154
00155 if (a == False or b == False):
00156 regstate=False
00157 raise Exception, "Regression test failed for 3C219D in task \"%s\"" %(taskname)
00158
00159 print "original equinox: ", a['ptcs'][1]['MEASINFO']['Ref']
00160 print " new equinox: ", b['ptcs'][1]['MEASINFO']['Ref']
00161
00162
00163
00164
00165
00166
00167
00168 print '--Clean 1-field, 1 scale--'
00169 status = True
00170 taskname = 'clean'
00171 default(taskname)
00172 vis = msfile
00173 imagename = testdir+'D-1scale'
00174 field = '1'
00175 imagermode = ''
00176 niter = 4000
00177 imsize = 512
00178 cell = '2arcsec'
00179 mask = rgnmask
00180 weighting = 'briggs'
00181 robust = 0.5
00182 pbcor = T
00183 restoringbeam = ['9arcsec']
00184 threshold = '0.4mJy'
00185 status = clean()
00186
00187 if status == False:
00188 regstate=False
00189 raise Exception, "Regression test failed for 3C219D in task \"%s\"" %(taskname)
00190
00191
00192
00193
00194
00195
00196
00197 print '--Clean 1-field, multi-scale--'
00198 status = True
00199 taskname = 'clean'
00200 default(taskname)
00201 vis = msfile
00202 imagename = testdir+'D-3scale'
00203 field = '1'
00204 imagermode=''
00205 niter = 2000
00206 imsize = 512
00207 multiscale = [0,5,15]
00208 cell = '2arcsec'
00209 mask = rgnmask
00210 weighting = 'briggs'
00211 robust = 0.5
00212 pbcor = T
00213 restoringbeam = ['9arcsec']
00214 threshold = '0.4mJy'
00215 status = clean()
00216
00217 if status == False:
00218 regstate=False
00219 raise Exception, "Regression test failed for 3C219D in task \"%s\"" %(taskname)
00220
00221
00222
00223
00224
00225
00226
00227 print '--Clean 3-field mosaic, 1 scale--'
00228 status = True
00229 taskname = 'clean'
00230 default(taskname)
00231 vis = msfile
00232 imagename = testdir+'D-1scale_mos'
00233 phasecenter = '1'
00234 field = '1,2,3'
00235 imagermode=''
00236 niter = 4000
00237 imsize = 512
00238 imagermode = 'mosaic'
00239 cell = '2arcsec'
00240 mask = rgnmask
00241 weighting = 'briggs'
00242 robust = 0.5
00243 restoringbeam = ['9arcsec']
00244 pbcor = T
00245 threshold = '0.4mJy'
00246 status = clean()
00247
00248 if status == False:
00249 regstate=False
00250 raise Exception, "Regression test failed for 3C219D in task \"%s\"" %(taskname)
00251
00252
00253
00254
00255
00256
00257 print '--Clean 3-field mosaic, multi-scale--'
00258 status = True
00259 taskname = 'clean'
00260 default(taskname)
00261 vis = msfile
00262 imagename = testdir+'D-3scale_mos'
00263 imagermode = 'mosaic'
00264 phasecenter = '1'
00265 field = '1,2,3'
00266 niter = 4000
00267 imsize = 512
00268 multiscale = [0,5,15]
00269 imagermode = 'mosaic'
00270 cell = '2arcsec'
00271 mask = rgnmask
00272 weighting = 'briggs'
00273 robust = 0.5
00274 restoringbeam = ['9arcsec']
00275 pbcor = T
00276 threshold = '0.4mJy'
00277 status = clean()
00278
00279 if status == False:
00280 regstate=False
00281 raise Exception, "Regression test failed for 3C219D in task \"%s\"" %(taskname)
00282
00283
00284
00285
00286
00287
00288 print '--Immath--'
00289 status = True
00290 taskname = 'immath'
00291 default (taskname)
00292 imagename = [testdir+'D-3scale.image',testdir+'D-3scale_mos.image']
00293 mode = 'evalexpr'
00294 outfile = testdir+'DIFF1.image'
00295 expr = ' (IM0 - IM1)'
00296 status = immath()
00297
00298 if status == None:
00299 regstate=False
00300 raise Exception, "Regression test failed for 3C219D in task \"%s\"" %(taskname)
00301
00302
00303
00304
00305
00306
00307 taskname = 'imstat'
00308 default (taskname)
00309
00310 box = '200,200,300,300'
00311 imagename = testdir+'DIFF1.image'
00312 a1=imstat()
00313
00314 if a1 == False:
00315 regstate=False
00316 raise Exception, "Regression test failed for 3C219D in task \"%s\"" %(taskname)
00317
00318
00319
00320
00321
00322
00323 status = True
00324 taskname = 'immath'
00325 default (taskname)
00326 imagename = [testdir+'D-1scale.image',testdir+'D-3scale.image']
00327 mode = 'evalexpr'
00328 outfile = testdir+'DIFF2.image'
00329 expr = ' (IM0 - IM1)'
00330 immath()
00331
00332 if status == None:
00333 regstate=False
00334 raise Exception, "Regression test failed for 3C219D in task \"%s\"" %(taskname)
00335
00336
00337
00338
00339
00340
00341 taskname = 'imstat'
00342 default (taskname)
00343
00344 box = '200,200,300,300'
00345 imagename = testdir+'DIFF2.image'
00346 a2=imstat()
00347
00348 if a2 == False:
00349 regstate=False
00350 raise Exception, "Regression test failed for 3C219D in task \"%s\"" %(taskname)
00351
00352
00353
00354
00355
00356 ref1_rms=0.0005
00357 ref2_rms=0.0002
00358
00359 print "difference between D-3scale.image and D-3scale_mos.image"
00360 print "diff: rms = ",a1['rms'][0],"; minimum= ",a1['min'][0],": maximum= ",a1['max'][0]
00361 print "difference between D-1scale.image and D-1scale_mos.image"
00362 print "diff: rms = ",a2['rms'][0],"; minimum= ",a2['min'][0],": maximum= ",a2['max'][0]
00363
00364 if((abs(ref1_rms-a1['rms']) > 0.001) or (abs(ref2_rms-a2['rms']) > 0.001)):
00365 print abs(ref1_rms-a1['rms'])
00366 print abs(ref2_rms-a2['rms'])
00367 regstate=False
00368 print ''
00369 print 'Regression FAILED'
00370 print ''
00371 raise Exception, 'Regression test failed for 3C219D. Absolute differences are larger than 1e-03.'
00372 else:
00373 print ''
00374 print 'Regression PASSED'
00375 print ''
00376
00377
00378
00379