00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 import time
00025 import os
00026
00027
00028 pathname=os.environ.get('CASAPATH').split()[0]
00029
00030
00031 regstate = True;
00032
00033
00034 startTime=time.time()
00035 startProc=time.clock()
00036
00037
00038 copyTime=time.time()
00039
00040 if(regstate):
00041
00042 print '--Image with MS-MFS--'
00043 default('clean')
00044 npix=1024;
00045 ret = clean(vis='VLA_multifrequency_3C286.ms',imagename='reg_3C286',imagermode='',
00046 nterms=3,reffreq='1.4GHz',
00047 niter=50,gain=0.8,threshold='7.0mJy',imsize=[npix,npix],
00048 cell=['2.5arcsec','2.5arcsec'],weighting='briggs',usescratch=False);
00049
00050
00051 print '--Post deconvolution wideband PB correction--'
00052 ret = widebandpbcor(vis='VLA_multifrequency_3C286.ms', imagename='reg_3C286',
00053 nterms=3, threshold='5mJy', action='pbcor', reffreq='1.4GHz',
00054 pbmin=0.2, field='',spwlist=[0, 1, 2, 3, 4, 5, 6], chanlist=[8, 8, 8, 8, 8, 8, 8],
00055 weightlist=[1, 1, 1, 1, 1, 1, 1])
00056
00057
00058 endProc=time.clock()
00059 endTime=time.time()
00060
00061
00062 import datetime
00063 datestring=datetime.datetime.isoformat(datetime.datetime.today())
00064 outfile='reg_3C286.'+datestring+'.log'
00065 logfile=open(outfile,'w')
00066
00067
00068 print >>logfile,'**************** Regression-test for wide-band imaging *************************'
00069 print >>logfile,'** **'
00070 print >>logfile,'****************** 3C286 wideband data (L-Band) *******************************'
00071 print >>logfile,''
00072 print >>logfile,'Observation: VLA'
00073 print >>logfile,'Data records: 145600 Total integration time = 35435 seconds'
00074 print >>logfile,' Observed from 28-Apr-2008/00:53:22.5 to 28-Apr-2008/10:43:57.5 (UTC)'
00075 print >>logfile,'Fields: 1'
00076 print >>logfile,' ID Code Name RA Decl Epoch SrcId nVis '
00077 print >>logfile,' 0 A 1331+305 13:31:08.2879 +30.30.32.9580 J2000 0 145600 '
00078 print >>logfile,' (nVis = Total number of time/baseline visibilities per field) '
00079 print >>logfile,'Spectral Windows: (7 unique spectral windows and 1 unique polarization setups)'
00080 print >>logfile,' SpwID #Chans Frame Ch1(MHz) ChanWid(kHz)TotBW(kHz) Ref(MHz) Corrs '
00081 print >>logfile,' 0 15 TOPO 1184.0625 1562.5 23437.5 1195 RR LL '
00082 print >>logfile,' 1 15 TOPO 1301.0625 1562.5 23437.5 1312 RR LL '
00083 print >>logfile,' 2 15 TOPO 1401.0625 1562.5 23437.5 1412 RR LL '
00084 print >>logfile,' 3 15 TOPO 1494.0625 1562.5 23437.5 1505 RR LL '
00085 print >>logfile,' 4 15 TOPO 1676.0625 1562.5 23437.5 1687 RR LL '
00086 print >>logfile,' 5 15 TOPO 1751.0625 1562.5 23437.5 1762 RR LL '
00087 print >>logfile,' 6 15 TOPO 1864.0625 1562.5 23437.5 1875 RR LL '
00088
00089
00090
00091 print >>logfile,''
00092 print >>logfile,'*********************** Comparison of results **********************************'
00093 print >>logfile,'** **'
00094 print >>logfile,'** (1) MS-MFS on the 3C286 field with nterms=3 and reffreq=1.4GHz **'
00095 print >>logfile,'** **'
00096 print >>logfile,'********************************************************************************'
00097
00098 if(not regstate):
00099 print >>logfile,'* Data file VLA_multifrequency_3C286.ms cannot be found';
00100 else:
00101
00102
00103 correct_sigma = 0.00126019103471;
00104 correct_sumsq = 1.6652231052;
00105 correct_intensity = 14.8404045105;
00106 correct_alpha = -0.471577763557;
00107 correct_beta = -0.124552100897;
00108
00109 correct_pbcor_intensity = 0.234191760421
00110 correct_pbcor_alpha = -0.910139858723
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151 if(os.path.exists('reg_3C286.residual.tt0')):
00152 ia.open('reg_3C286.residual.tt0');
00153 stats = ia.statistics();
00154 ia.close();
00155 diff_sigma = abs( (stats['sigma'][0]) - correct_sigma )/correct_sigma;
00156 diff_sumsq = abs( (stats['sumsq'][0]) - correct_sumsq )/correct_sumsq;
00157 if(diff_sigma<0.05):
00158 print >>logfile,'* Passed residual sigma test ';
00159 else:
00160 print >>logfile,'* FAILED residual sigma test '
00161 regstate = False;
00162 print >>logfile,'-- residual sigma : ' + str((stats['sigma'][0])) + ' (' + str(correct_sigma) + ')';
00163 if(diff_sumsq<0.05):
00164 print >>logfile,'* Passed residual total-power test ';
00165 else:
00166 print >>logfile,'* FAILED residual total-power test '
00167 regstate = False
00168 print >>logfile,'-- residual sumsq : ' + str((stats['sumsq'][0])) + ' (' + str(correct_sumsq) + ')';
00169 else:
00170 print >>logfile,' FAILED : No residual image generated.'
00171 regstate = False;
00172
00173
00174 if(os.path.exists('reg_3C286.image.tt0')):
00175 ia.open('reg_3C286.image.tt0');
00176 midpix = ia.pixelvalue([npix/2,npix/2])
00177 ia.close();
00178 diff_intensity = abs( midpix['value']['value'] - correct_intensity )/ abs(correct_intensity);
00179 if(diff_intensity<0.02):
00180 print >>logfile,'* Passed peak intensity test ';
00181 else:
00182 print >>logfile,'* FAILED peak intensity test '
00183 regstate = False;
00184 print >>logfile,'-- peak intensity : ' + str(midpix['value']['value']) + ' (' + str(correct_intensity) + ')';
00185 else:
00186 print >>logfile,'-- FAILED : No intensity map generated';
00187 regstate = False;
00188
00189
00190 if(os.path.exists('reg_3C286.image.alpha')):
00191 ia.open('reg_3C286.image.alpha');
00192 midpix = ia.pixelvalue([npix/2,npix/2])
00193 ia.close();
00194 diff_alpha = abs( midpix['value']['value'] - correct_alpha )/ abs(correct_alpha);
00195 if(diff_alpha<0.02):
00196 print >>logfile,'* Passed spectral index test ';
00197 else:
00198 print >>logfile,'* FAILED spectral index test '
00199 regstate = False;
00200 print >>logfile,'-- spectral index : ' + str(midpix['value']['value']) + ' (' + str(correct_alpha) + ')';
00201 else:
00202 print >>logfile,'-- FAILED : No spectral index map generated';
00203 regstate = False;
00204
00205
00206 if(os.path.exists('reg_3C286.image.beta')):
00207 ia.open('reg_3C286.image.beta');
00208 midpix = ia.pixelvalue([npix/2,npix/2])
00209 ia.close();
00210 diff_beta = abs( midpix['value']['value'] - correct_beta )/ abs(correct_beta);
00211 if(diff_beta<0.02):
00212 print >>logfile,'* Passed spectral curvature test ';
00213 else:
00214 print >>logfile,'* FAILED spectral curvature test '
00215 regstate = False;
00216 print >>logfile,'-- spectral curvature : ' + str(midpix['value']['value']) + ' (' + str(correct_beta) + ')';
00217 else:
00218 print >>logfile,'-- FAILED : No spectral curvature map generated';
00219 regstate = False;
00220
00221
00222 if(os.path.exists('reg_3C286.pbcor.image.tt0')):
00223 ia.open('reg_3C286.pbcor.image.tt0');
00224 offpix = ia.pixelvalue([304,542])
00225 ia.close();
00226 diff_int = abs( offpix['value']['value'] - correct_pbcor_intensity )/ abs(correct_pbcor_intensity);
00227 if(diff_int<0.02):
00228 print >>logfile,'* Passed widebandpbcor intensity test ';
00229 else:
00230 print >>logfile,'* FAILED widebandpbcor intensity test '
00231 regstate = False;
00232 print >>logfile,'-- pb-corrected intensity : ' + str(offpix['value']['value']) + ' (' + str(correct_pbcor_intensity) + ')';
00233 else:
00234 print >>logfile,'-- FAILED : No pb-corrected intensity map generated';
00235 regstate = False;
00236
00237
00238 if(os.path.exists('reg_3C286.pbcor.image.alpha')):
00239 ia.open('reg_3C286.pbcor.image.alpha');
00240 offpix = ia.pixelvalue([304,542])
00241 ia.close();
00242 diff_alpha = abs( offpix['value']['value'] - correct_pbcor_alpha )/ abs(correct_pbcor_alpha);
00243 if(diff_alpha<0.02):
00244 print >>logfile,'* Passed widebandpbcor alpha test ';
00245 else:
00246 print >>logfile,'* FAILED widebandpbcor alpha test '
00247 regstate = False;
00248 print >>logfile,'-- pb-corrected spectral index : ' + str(offpix['value']['value']) + ' (' + str(correct_pbcor_alpha) + ')';
00249 else:
00250 print >>logfile,'-- FAILED : No pb-corrected spectral index map generated';
00251 regstate = False;
00252
00253
00254
00255 if(regstate):
00256 print >>logfile,'PASSED regression test for wideband-imaging.'
00257 print ''
00258 print 'Regression PASSED'
00259 print ''
00260 else:
00261 print >>logfile,'FAILED regression test for wideband-imaging.'
00262 print ''
00263 print 'Regression FAILED'
00264 print ''
00265
00266 print >>logfile,''
00267
00268
00269 print >>logfile,'********************************************************************************'
00270 print >>logfile,'** Benchmarking **'
00271 print >>logfile,'********************************************************************************'
00272 print >>logfile,'Total wall clock time was: '+str(endTime - startTime)
00273 print >>logfile,'Total CPU time was: '+str(endProc - startProc)
00274 print >>logfile,'Processing rate MB/s was: '+str(278./(endTime - startTime))
00275 print >>logfile,'* Breakdown: *'
00276 print >>logfile,'* copy time was: '+str(copyTime-startTime)
00277 print >>logfile,'* imaging time was: '+str(endTime-copyTime)
00278 print >>logfile,'* *'
00279 print >>logfile,'********************************************************************************'
00280
00281 logfile.close()
00282
00283