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
00054
00055
00056
00057
00058 import time
00059 import os
00060 import pickle
00061
00062
00063 usemms_step = -1
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075 usefieldwise = True
00076
00077
00078 def makefieldwisemms(msname):
00079 casalog.post('******* Making field-wise MMS. *******', "INFO", 'makefieldwisemms')
00080 print '******* Making field-wise MMS. *******'
00081 os.system('rm -rf temp.ms; mv '+msname+' temp.ms')
00082 members = []
00083 tb.open('temp.ms/FIELD')
00084 nfield = tb.nrows()
00085 tb.close()
00086 for i in range(0,nfield):
00087 member = 'ngc4826.tutorial-field'+str(i)+'.ms'
00088 os.system('rm -rf '+member)
00089 print member
00090 split(vis='temp.ms', outputvis=member, field=i, datacolumn='all')
00091 members.append(member)
00092 concat(vis=members, concatvis=msname, createmms=True)
00093
00094 def makespwwisemms(msname):
00095 casalog.post('******* Making spw-wise MMS. *******', "INFO", 'makespwwisemms')
00096 print '******* Making spw-wise MMS. *******'
00097 os.system('rm -rf temp.ms; mv '+msname+' temp.ms')
00098 members = []
00099 tb.open('temp.ms/SPECTRAL_WINDOW')
00100 nspw = tb.nrows()
00101 tb.close()
00102 for i in range(0,nspw):
00103 member = 'ngc4826.tutorial-spw'+str(i)+'.ms'
00104 os.system('rm -rf '+member)
00105 print member
00106 split(vis='temp.ms', outputvis=member, spw=str(i), datacolumn='all')
00107 members.append(member)
00108 concat(vis=members, concatvis=msname, createmms=True)
00109
00110
00111
00112
00113
00114
00115 scriptmode = False
00116
00117
00118 benchmarking = True
00119
00120
00121 scriptprefix='ngc4826_tutorial_regression'
00122
00123
00124
00125
00126
00127 os.system('rm -rf ngc4826.tutorial.*')
00128
00129
00130 prefix='ngc4826.tutorial'
00131 msfile = prefix + '.16apr98.ms'
00132
00133 print 'Tutorial Regression Script for BIMASONG NGC4826 Mosaic'
00134 print 'Version for Release 0 (3.0.0) 7-Dec-2009'
00135 print 'Will do: import, flagging, calibration, imaging'
00136 print ''
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160 if benchmarking:
00161 startTime=time.time()
00162 startProc=time.clock()
00163
00164 _mydatapath = os.environ.get('CASAPATH').split()[0]+'/data/regression/ngc4826/'
00165
00166
00167
00168
00169
00170
00171
00172 print '--Importuvfits (16apr98)--'
00173 default('importuvfits')
00174
00175 print "Starting from the uvfits files exported by miriad"
00176 print "The USB spectral windows were written separately by miriad for 16apr98"
00177
00178 importuvfits(fitsfile=_mydatapath+'fitsfiles/3c273.fits5', vis='ngc4826.tutorial.3c273.5.ms')
00179
00180 importuvfits(fitsfile=_mydatapath+'fitsfiles/3c273.fits6', vis='ngc4826.tutorial.3c273.6.ms')
00181
00182 importuvfits(fitsfile=_mydatapath+'fitsfiles/3c273.fits7', vis='ngc4826.tutorial.3c273.7.ms')
00183
00184 importuvfits(fitsfile=_mydatapath+'fitsfiles/3c273.fits8', vis='ngc4826.tutorial.3c273.8.ms')
00185
00186 importuvfits(fitsfile=_mydatapath+'fitsfiles/1310+323.ll.fits9', vis='ngc4826.tutorial.1310+323.ll.9.ms')
00187
00188 importuvfits(fitsfile=_mydatapath+'fitsfiles/1310+323.ll.fits10', vis='ngc4826.tutorial.1310+323.ll.10.ms')
00189
00190 importuvfits(fitsfile=_mydatapath+'fitsfiles/1310+323.ll.fits11', vis='ngc4826.tutorial.1310+323.ll.11.ms')
00191
00192 importuvfits(fitsfile=_mydatapath+'fitsfiles/1310+323.ll.fits12', vis='ngc4826.tutorial.1310+323.ll.12.ms')
00193
00194 importuvfits(fitsfile=_mydatapath+'fitsfiles/1310+323.ll.fits13', vis='ngc4826.tutorial.1310+323.ll.13.ms')
00195
00196 importuvfits(fitsfile=_mydatapath+'fitsfiles/1310+323.ll.fits14', vis='ngc4826.tutorial.1310+323.ll.14.ms')
00197
00198 importuvfits(fitsfile=_mydatapath+'fitsfiles/1310+323.ll.fits15', vis='ngc4826.tutorial.1310+323.ll.15.ms')
00199
00200 importuvfits(fitsfile=_mydatapath+'fitsfiles/1310+323.ll.fits16', vis='ngc4826.tutorial.1310+323.ll.16.ms')
00201
00202 importuvfits(fitsfile=_mydatapath+'fitsfiles/ngc4826.ll.fits5', vis='ngc4826.tutorial.ngc4826.ll.5.ms')
00203
00204 importuvfits(fitsfile=_mydatapath+'fitsfiles/ngc4826.ll.fits6', vis='ngc4826.tutorial.ngc4826.ll.6.ms')
00205
00206 importuvfits(fitsfile=_mydatapath+'fitsfiles/ngc4826.ll.fits7', vis='ngc4826.tutorial.ngc4826.ll.7.ms')
00207
00208 importuvfits(fitsfile=_mydatapath+'fitsfiles/ngc4826.ll.fits8', vis='ngc4826.tutorial.ngc4826.ll.8.ms')
00209
00210 if benchmarking:
00211 import2time=time.time()
00212
00213
00214
00215
00216 print '--Concat--'
00217 default('concat')
00218
00219 concat(vis=['ngc4826.tutorial.3c273.5.ms',
00220 'ngc4826.tutorial.3c273.6.ms',
00221 'ngc4826.tutorial.3c273.7.ms',
00222 'ngc4826.tutorial.3c273.8.ms',
00223 'ngc4826.tutorial.1310+323.ll.9.ms',
00224 'ngc4826.tutorial.1310+323.ll.10.ms',
00225 'ngc4826.tutorial.1310+323.ll.11.ms',
00226 'ngc4826.tutorial.1310+323.ll.12.ms',
00227 'ngc4826.tutorial.1310+323.ll.13.ms',
00228 'ngc4826.tutorial.1310+323.ll.14.ms',
00229 'ngc4826.tutorial.1310+323.ll.15.ms',
00230 'ngc4826.tutorial.1310+323.ll.16.ms',
00231 'ngc4826.tutorial.ngc4826.ll.5.ms',
00232 'ngc4826.tutorial.ngc4826.ll.6.ms',
00233 'ngc4826.tutorial.ngc4826.ll.7.ms',
00234 'ngc4826.tutorial.ngc4826.ll.8.ms'],
00235 concatvis='ngc4826.tutorial.ms',
00236 freqtol="",dirtol="1arcsec",async=False, createmms=(usemms_step==0))
00237
00238 if benchmarking:
00239 concat2time=time.time()
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326 print '--Clearcal--'
00327 print 'Create scratch columns and initialize in '+'ngc4826.tutorial.ms'
00328
00329
00330
00331
00332 clearcal(vis='ngc4826.tutorial.ms', addmodel=False)
00333
00334 if benchmarking:
00335 clearcal2time=time.time()
00336
00337
00338
00339
00340
00341
00342 print '--Listobs--'
00343 listobs(vis='ngc4826.tutorial.ms')
00344
00345
00346
00347
00348
00349 print "There are 3 fields observed in a total of 16 spectral windows"
00350 print " field=0 3c273 spwids 0,1,2,3 64 chans "
00351 print " field=1 1310+323 spwids 4,5,6,7,8,9,10,11 32 chans "
00352 print " field=2~8 NGC4826 spwids 12,13,14,15 64 chans "
00353 print ""
00354 print "See listobs summary in logger"
00355
00356 if benchmarking:
00357 list2time=time.time()
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515 if benchmarking:
00516 plotxy2time=time.time()
00517
00518 if (usemms_step==1):
00519 if usefieldwise:
00520 makefieldwisemms('ngc4826.tutorial.ms')
00521 else:
00522 makespwwisemms('ngc4826.tutorial.ms')
00523
00524
00525
00526
00527
00528
00529
00530 print '--Flagdata--'
00531 default('tflagdata')
00532
00533 print ""
00534 print "Flagging edge channels in all spw"
00535 print " 0~3:0~1;62~63 , 4~11:0~1;30~31, 12~15:0~1;62~63 "
00536 print ""
00537
00538 tflagdata(vis='ngc4826.tutorial.ms', mode='manual',
00539 spw='0~3:0;1;62;63,4~11:0;1;30;31,12~15:0;1;62;63')
00540
00541
00542
00543
00544 print ""
00545 print "Flagging bad correlator field 8 antenna 3&9 spw 15 all channels"
00546 print " timerange 1998/04/16/06:19:00.0~1998/04/16/06:20:00.0"
00547 print ""
00548
00549 tflagdata(vis='ngc4826.tutorial.ms', mode='manual', field='8', spw='15', antenna='3&9',
00550 timerange='1998/04/16/06:19:00.0~1998/04/16/06:20:00.0')
00551
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577 print '--Flagmanager--'
00578 default('flagmanager')
00579
00580 print "Now will use flagmanager to save a copy of the flags we just made"
00581 print "These are named myflags"
00582
00583 flagmanager(vis='ngc4826.tutorial.ms',mode='save',versionname='myflags',
00584 comment='My flags',merge='replace')
00585
00586
00587
00588 flagmanager(vis='ngc4826.tutorial.ms',mode='list')
00589
00590 if benchmarking:
00591 flag2time=time.time()
00592
00593 print "Completed pre-calibration flagging"
00594
00595 if (usemms_step==2):
00596 if usefieldwise:
00597 makefieldwisemms('ngc4826.tutorial.ms')
00598 else:
00599 makespwwisemms('ngc4826.tutorial.ms')
00600
00601
00602
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621 print '--Setjy (3C273)--'
00622 default('setjy')
00623
00624 setjy(vis='ngc4826.tutorial.ms',field='0',fluxdensity=[23.0,0.,0.,0.],spw='0~3', scalebychan=False, usescratch=False)
00625
00626
00627
00628
00629 if benchmarking:
00630 setjy2time=time.time()
00631
00632 if (usemms_step==3):
00633 if usefieldwise:
00634 makefieldwisemms('ngc4826.tutorial.ms')
00635 else:
00636 makespwwisemms('ngc4826.tutorial.ms')
00637
00638
00639
00640
00641
00642
00643
00644 print '--Gaincal--'
00645 default('gaincal')
00646
00647
00648
00649
00650 print 'Gain calibration for fields 0,1 and spw 0~11'
00651 print 'Using solint=inf combining over spw'
00652 print 'Output table ngc4826.tutorial.16apr98.gcal'
00653
00654 gaincal(vis='ngc4826.tutorial.ms', caltable='ngc4826.tutorial.16apr98.gcal',
00655 field='0,1', spw='0~11', gaintype='G', minsnr=2.0,
00656 refant='ANT5', gaincurve=False, opacity=0.0,
00657 solint='inf', combine='spw')
00658
00659 if benchmarking:
00660 gaincal2time=time.time()
00661
00662 if (usemms_step==4):
00663 if usefieldwise:
00664 makefieldwisemms('ngc4826.tutorial.ms')
00665 else:
00666 makespwwisemms('ngc4826.tutorial.ms')
00667
00668
00669
00670
00671
00672
00673
00674 print '--Fluxscale--'
00675 default('fluxscale')
00676
00677 print ''
00678 print 'Transferring flux of 3C273 to sources: 1310+323'
00679 print 'Output table ngc4826.tutorial.16apr98.fcal'
00680
00681 fluxscale(vis='ngc4826.tutorial.ms', caltable='ngc4826.tutorial.16apr98.gcal',
00682 fluxtable='ngc4826.tutorial.16apr98.fcal',
00683 reference='3C273', transfer=['1310+323'])
00684
00685
00686
00687 if benchmarking:
00688 fluxscale2time=time.time()
00689
00690 if (usemms_step==5):
00691 if usefieldwise:
00692 makefieldwisemms('ngc4826.tutorial.ms')
00693 else:
00694 makespwwisemms('ngc4826.tutorial.ms')
00695
00696
00697
00698
00699
00700
00701 print '--Plotcal (fluxscale)--'
00702 default(plotcal)
00703
00704 if scriptmode:
00705
00706 plotcal(caltable='ngc4826.tutorial.16apr98.fcal', yaxis='amp', field='')
00707 print ''
00708 print 'Plotting final scaled gain calibration table'
00709 print 'First amp vs. time for all fields '
00710
00711
00712 user_check=raw_input('Return to continue script\n')
00713
00714 plotcal(caltable='ngc4826.tutorial.16apr98.fcal', yaxis='phase', field='')
00715 print ''
00716 print 'and phase vs. time '
00717
00718
00719 user_check=raw_input('Return to continue script\n')
00720
00721
00722 plotcal(caltable='ngc4826.tutorial.16apr98.fcal', yaxis='snr', field='')
00723 else:
00724
00725 plotcal(caltable='ngc4826.tutorial.16apr98.fcal',yaxis='amp',field='',
00726 showgui=False,figfile='ngc4826.tutorial.16apr98.fcal.plotcal.amp.png')
00727 plotcal(caltable='ngc4826.tutorial.16apr98.fcal',yaxis='phase',field='',
00728 showgui=False,figfile='ngc4826.tutorial.16apr98.fcal.plotcal.phase.png')
00729 plotcal(caltable='ngc4826.tutorial.16apr98.fcal',yaxis='snr',field='',
00730 showgui=False,figfile='ngc4826.tutorial.16apr98.fcal.plotcal.snr.png')
00731
00732 if benchmarking:
00733 plotcal2time=time.time()
00734
00735
00736
00737
00738
00739
00740
00741
00742 print '--Applycal--'
00743 default('applycal')
00744
00745 print 'Applying calibration table ngc4826.tutorial.16apr98.fcal to data'
00746
00747 applycal(vis='ngc4826.tutorial.ms',
00748 field='', spw='',
00749 gaincurve=False, opacity=0.0,
00750 gaintable='ngc4826.tutorial.16apr98.fcal',
00751 spwmap=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])
00752
00753 if benchmarking:
00754 correct2time=time.time()
00755
00756 if (usemms_step==6):
00757 if usefieldwise:
00758 makefieldwisemms('ngc4826.tutorial.ms')
00759 else:
00760 makespwwisemms('ngc4826.tutorial.ms')
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772
00773
00774
00775
00776
00777
00778
00779
00780
00781
00782
00783
00784
00785
00786
00787
00788
00789
00790
00791
00792
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802
00803
00804
00805
00806
00807
00808
00809
00810
00811
00812
00813
00814
00815
00816
00817
00818
00819
00820
00821
00822
00823
00824
00825
00826
00827
00828
00829
00830
00831
00832
00833
00834
00835
00836
00837
00838 print "Done calibration and plotting"
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850 print '--Split--'
00851 default('split')
00852
00853 print 'Splitting 3C273 data to ngc4826.tutorial.16apr98.3C273.split.ms'
00854
00855 split(vis='ngc4826.tutorial.ms',
00856 outputvis='ngc4826.tutorial.16apr98.3C273.split.ms',
00857 field='0',spw='0~3:0~63', datacolumn='corrected')
00858
00859 print 'Splitting 1310+323 data to ngc4826.tutorial.16apr98.1310+323.split.ms'
00860
00861 split(vis='ngc4826.tutorial.ms',
00862 outputvis='ngc4826.tutorial.16apr98.1310+323.split.ms',
00863 field='1', spw='4~11:0~31', datacolumn='corrected')
00864
00865 print 'Splitting NGC4826 data to ngc4826.tutorial.16apr98.src.split.ms'
00866
00867 split(vis='ngc4826.tutorial.ms',
00868 outputvis='ngc4826.tutorial.16apr98.src.split.ms',
00869 field='2~8', spw='12~15:0~63',
00870 datacolumn='corrected')
00871
00872 if benchmarking:
00873 split2time=time.time()
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883
00884
00885
00886
00887
00888
00889
00890
00891
00892
00893
00894
00895
00896
00897
00898
00899
00900
00901
00902
00903
00904
00905
00906
00907
00908
00909
00910
00911
00912
00913
00914
00915
00916 if (usemms_step==7):
00917 if usefieldwise:
00918 makefieldwisemms('ngc4826.tutorial.16apr98.3C273.split.ms')
00919 makefieldwisemms('ngc4826.tutorial.16apr98.1310+323.split.ms')
00920 makefieldwisemms('ngc4826.tutorial.16apr98.src.split.ms')
00921 else:
00922 makespwwisemms('ngc4826.tutorial.16apr98.3C273.split.ms')
00923 makespwwisemms('ngc4826.tutorial.16apr98.1310+323.split.ms')
00924 makespwwisemms('ngc4826.tutorial.16apr98.src.split.ms')
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934
00935
00936
00937
00938
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951 print '--Clean (NGC4826)--'
00952 default('clean')
00953
00954
00955 clnsize = 400
00956 print " Creating CLEAN image of size "+str(clnsize)
00957
00958 clean(vis='ngc4826.tutorial.16apr98.src.split.ms',
00959 imagename='ngc4826.tutorial.16apr98.src.clean',
00960 field='0~6',spw='0~3',
00961 cell=[1.,1.],imsize=[clnsize,clnsize],
00962 stokes='I',
00963 mode='channel',nchan=36,start=34,width=4,
00964 interpolation='nearest',
00965 psfmode='clark',imagermode='mosaic',ftmachine='mosaic',
00966 scaletype='SAULT',
00967
00968
00969
00970 cyclefactor=4,niter=10000,threshold='45mJy',
00971 minpb=0.3,pbcor=False, usescratch=False)
00972
00973
00974
00975
00976
00977
00978
00979
00980
00981
00982
00983
00984
00985
00986
00987
00988
00989
00990
00991
00992
00993
00994
00995
00996 if benchmarking:
00997 clean2time=time.time()
00998
00999
01000
01001
01002
01003 print '--Viewer--'
01004 if scriptmode:
01005 viewer('ngc4826.tutorial.16apr98.src.clean.image')
01006
01007 print ""
01008 print "This is the non-pbcorrected cube of NGC4826"
01009 print "Use tape deck to move through channels"
01010 print "Close the viewer when done"
01011 print ""
01012
01013
01014 user_check=raw_input('Return to continue script\n')
01015
01016
01017
01018
01019
01020
01021 print '--ImStat (Clean cube)--'
01022
01023 srcstat = imstat('ngc4826.tutorial.16apr98.src.clean.image')
01024
01025 print "Found image max = "+str(srcstat['max'][0])
01026
01027
01028
01029
01030
01031 refpix = int(clnsize/2)
01032 refbox = str(refpix)+','+str(refpix)+','+str(refpix)+','+str(refpix)
01033 print " Using Reference Pixel "+refbox
01034
01035
01036
01037
01038
01039 blcx = refpix - 22
01040 blcy = refpix + 33
01041 trcx = refpix + 25
01042 trcy = refpix + 72
01043 offbox = str(blcx)+','+str(blcy)+','+str(trcx)+','+str(trcy)
01044 print " Using Off-Source Box "+offbox
01045
01046 offstat = imstat('ngc4826.tutorial.16apr98.src.clean.image',
01047 box=offbox)
01048
01049 print "Found off-source image rms = "+str(offstat['sigma'][0])
01050
01051
01052
01053
01054
01055 blcx = refpix - 20
01056 blcy = refpix - 20
01057 trcx = refpix + 20
01058 trcy = refpix + 20
01059 cenbox = str(blcx)+','+str(blcy)+','+str(trcx)+','+str(trcy)
01060 print " Using On-Source Box "+cenbox
01061
01062
01063
01064 offlinestat = imstat('ngc4826.tutorial.16apr98.src.clean.image',
01065 box=cenbox,
01066 chans='0,1,2,3,4,5,30,31,32,33,34,35')
01067
01068 print "Found off-line image rms = "+str(offlinestat['sigma'][0])
01069
01070
01071
01072
01073
01074
01075 print '--ImStat (Clean model)--'
01076
01077 modstat = imstat('ngc4826.tutorial.16apr98.src.clean.model')
01078
01079 print "Found total model flux = "+str(modstat['sum'][0])
01080
01081
01082
01083
01084
01085
01086 print '--ImMath (PBcor)--'
01087
01088 immath(outfile='ngc4826.tutorial.16apr98.src.clean.pbcor',
01089 mode='evalexpr',
01090 expr="'ngc4826.tutorial.16apr98.src.clean.image'/'ngc4826.tutorial.16apr98.src.clean.flux'")
01091
01092
01093
01094 immath(outfile='ngc4826.tutorial.16apr98.src.clean.pbcormod',
01095 mode='evalexpr',
01096 expr="'ngc4826.tutorial.16apr98.src.clean.model'['ngc4826.tutorial.16apr98.src.clean.model'!=0.0]/'ngc4826.tutorial.16apr98.src.clean.flux'")
01097
01098
01099
01100
01101
01102
01103
01104 print '--ImStat (PBcor cube)--'
01105
01106 pbcorstat = imstat('ngc4826.tutorial.16apr98.src.clean.pbcor')
01107
01108 print "Found image max = "+str(pbcorstat['max'][0])
01109
01110 pbcoroffstat = imstat('ngc4826.tutorial.16apr98.src.clean.pbcor',
01111 box=offbox)
01112
01113 print "Found off-source image rms = "+str(pbcoroffstat['sigma'][0])
01114
01115 pbcorofflinestat = imstat('ngc4826.tutorial.16apr98.src.clean.pbcor',
01116 box=cenbox,
01117 chans='0,1,2,3,4,5,30,31,32,33,34,35')
01118
01119 print "Found off-line image rms = "+str(pbcorofflinestat['sigma'][0])
01120
01121
01122
01123
01124 print '--ImStat (PSF)--'
01125
01126 psfstat = imstat('ngc4826.tutorial.16apr98.src.clean.psf',
01127 box=refbox,chans='27')
01128
01129 print "Found PSF value at refpix = "+str(psfstat['mean'][0])+" (should be 1.0)"
01130
01131 if benchmarking:
01132 math2time=time.time()
01133
01134
01135
01136
01137 print '--ImStat (PBcor model)--'
01138
01139 pbcormodstat = imstat('ngc4826.tutorial.16apr98.src.clean.pbcormod')
01140
01141 print "Found total model flux = "+str(pbcormodstat['sum'][0])
01142
01143
01144
01145
01146
01147
01148
01149
01150
01151
01152
01153 print '--ImMoments--'
01154 default('immoments')
01155
01156 momfile = 'ngc4826.tutorial.16apr98.moments'
01157 momzeroimage = 'ngc4826.tutorial.16apr98.moments.integrated'
01158 momoneimage = 'ngc4826.tutorial.16apr98.moments.mom1'
01159
01160 print "Calculating Moments 0,1 for PBcor image"
01161
01162
01163
01164
01165 immoments(imagename='ngc4826.tutorial.16apr98.src.clean.pbcor',
01166 moments=[0],
01167 chans='6~27',
01168 outfile='ngc4826.tutorial.16apr98.moments.integrated')
01169
01170
01171
01172
01173
01174
01175
01176
01177
01178
01179
01180
01181
01182
01183 immoments(imagename='ngc4826.tutorial.16apr98.src.clean.image',
01184 moments=[1],includepix=[0.2,1000.0],
01185 chans='6~27',
01186 outfile='ngc4826.tutorial.16apr98.moments.mom1')
01187
01188
01189 if scriptmode:
01190 viewer('ngc4826.tutorial.16apr98.moments.integrated')
01191
01192 print "Now viewing Moment-0 ngc4826.tutorial.16apr98.moments.integrated"
01193 print "Note PBCOR effects at field edge"
01194 print "Change the colorscale to get better image"
01195 print "You can also Open and overlay Contours of Moment-1 ngc4826.tutorial.16apr98.moments.mom1"
01196 print "Close the viewer when done"
01197
01198
01199 user_check=raw_input('Return to continue script\n')
01200
01201
01202
01203 try:
01204 immoments(imagename='ngc4826.tutorial.16apr98.src.clean.image',
01205 moments=[1],includepix=[],
01206 chans='0',
01207 outfile='ngc4826.tutorial.16apr98.moments.plane0.mom1')
01208 except:
01209 pass
01210
01211
01212 try:
01213 immoments(imagename='ngc4826.tutorial.16apr98.src.clean.image',
01214 moments=[1],includepix=[],
01215 chans='35',
01216 outfile='ngc4826.tutorial.16apr98.moments.plane35.mom1')
01217 except:
01218 pass
01219
01220 if benchmarking:
01221 moments2time=time.time()
01222
01223
01224
01225
01226
01227
01228 print '--ImStat (Moment images)--'
01229
01230 momzerostat=imstat('ngc4826.tutorial.16apr98.moments.integrated')
01231
01232 try:
01233 print "Found moment 0 max = "+str(momzerostat['max'][0])
01234 print "Found moment 0 rms = "+str(momzerostat['rms'][0])
01235 except:
01236 pass
01237
01238 momonestat = imstat('ngc4826.tutorial.16apr98.moments.mom1')
01239
01240 try:
01241 print "Found moment 1 median = "+str(momonestat['median'][0])
01242 except:
01243 pass
01244
01245
01246
01247 ia.open('ngc4826.tutorial.16apr98.src.clean.image')
01248 csys=ia.coordsys()
01249 vel0=0.0
01250 vel35=0.0
01251
01252 try:
01253 momoneplane0=imstat('ngc4826.tutorial.16apr98.moments.plane0.mom1')
01254 print "Found plane 0 moment 1 value = "+str(momoneplane0['median'][0])
01255 except:
01256 pass
01257
01258
01259 try:
01260 momoneplane35=imstat('ngc4826.tutorial.16apr98.moments.plane35.mom1')
01261 print "Found plane 35 moment 1 value = "+str(momoneplane35['median'][0])
01262 except:
01263 pass
01264
01265 if(type(momoneplane0)==bool):
01266 vel0=csys.frequencytovelocity(ia.toworld([0,0,0,0])['numeric'][3])
01267 if(type(momoneplane35)==bool):
01268 vel35=csys.frequencytovelocity(ia.toworld([0,0,0,35])['numeric'][3])
01269
01270
01271
01272
01273
01274
01275
01276 ms.open('ngc4826.tutorial.16apr98.1310+323.split.ms')
01277 vismean_cal=pl.mean(ms.range(["amplitude"]).get("amplitude"))
01278 ms.close()
01279 ms.open('ngc4826.tutorial.16apr98.src.split.ms')
01280 vismean_src=pl.mean(ms.range(["amplitude"]).get("amplitude"))
01281 ms.close()
01282
01283
01284
01285
01286
01287
01288
01289
01290
01291
01292
01293
01294
01295
01296
01297
01298
01299
01300
01301
01302
01303
01304
01305
01306
01307
01308
01309
01310
01311
01312
01313
01314
01315
01316
01317
01318
01319
01320
01321
01322
01323
01324
01325
01326
01327
01328
01329
01330
01331
01332
01333
01334
01335
01336
01337
01338
01339
01340
01341
01342
01343
01344
01345
01346
01347
01348
01349
01350
01351
01352
01353
01354
01355
01356
01357 if benchmarking:
01358 endProc=time.clock()
01359 endTime=time.time()
01360
01361
01362
01363
01364
01365
01366
01367
01368
01369
01370
01371
01372
01373
01374
01375
01376
01377
01378
01379
01380
01381
01382
01383
01384
01385
01386
01387
01388
01389
01390
01391
01392
01393
01394
01395
01396
01397
01398
01399
01400
01401
01402
01403
01404
01405
01406
01407
01408
01409
01410
01411
01412
01413
01414
01415
01416
01417
01418
01419
01420
01421
01422
01423
01424
01425
01426
01427
01428
01429
01430
01431
01432
01433
01434
01435
01436
01437
01438
01439
01440
01441
01442
01443
01444
01445
01446
01447
01448
01449
01450
01451
01452
01453
01454
01455
01456
01457
01458
01459
01460
01461
01462
01463
01464
01465
01466
01467
01468
01469
01470
01471
01472
01473
01474
01475
01476
01477
01478
01479
01480
01481
01482
01483
01484
01485
01486
01487
01488
01489
01490
01491
01492
01493
01494
01495
01496
01497
01498
01499
01500
01501
01502
01503
01504
01505
01506
01507
01508
01509
01510
01511
01512
01513
01514
01515
01516
01517
01518
01519
01520
01521
01522
01523 testdate = '2010-04-29 (RR)'
01524 testvers = 'CASA Version 3.0.2 (build #11306)'
01525 clean_image_max = 1.615747
01526 clean_offsrc_rms = 0.058497
01527 clean_offline_rms = 0.055416
01528 clean_momentzero_max = 163.726852
01529 clean_momentzero_rms = 15.206372
01530
01531
01532
01533 clean_momentone_median = 422.92
01534 clean_momentone_planezero = 696.702393
01535 clean_momentone_planelast = 127.786629
01536 vis_mean_cal = 195.0509
01537 vis_mean_src = 54.665
01538 model_sum = 75.7516
01539 model_pbcor_sum = 75.92
01540
01541
01542
01543
01544
01545
01546 clean_offsrc_rms = 0.04736
01547 clean_offline_rms = 0.049904
01548 clean_momentzero_rms = 13.737679
01549
01550 clean_momentone_median = 435.368103
01551
01552 model_pbcor_sum = 77.7232
01553
01554
01555
01556
01557
01558
01559
01560
01561
01562
01563
01564
01565 clean_image_max = 1.4637
01566 clean_momentone_median = 424.3254
01567 clean_momentone_planezero = 690.6068
01568 clean_momentone_planelast = 121.6911
01569
01570 canonical = {}
01571 canonical['exist'] = True
01572
01573 canonical['date'] = testdate
01574 canonical['version'] = testvers
01575 canonical['user'] = 'smyers'
01576 canonical['host'] = 'sandrock'
01577 canonical['cwd'] = '/home/sandrock/smyers/Testing/Patch4/N4826'
01578 print "Using internal regression from "+canonical['version']+" on "+canonical['date']
01579
01580 canonical_results = {}
01581 canonical_results['clean_image_max'] = {}
01582 canonical_results['clean_image_max']['value'] = clean_image_max
01583 canonical_results['clean_image_offsrc_max'] = {}
01584 canonical_results['clean_image_offsrc_max']['value'] = clean_offsrc_rms
01585 canonical_results['clean_image_offline_max'] = {}
01586 canonical_results['clean_image_offline_max']['value'] = clean_offline_rms
01587 canonical_results['clean_momentzero_max'] = {}
01588 canonical_results['clean_momentzero_max']['value'] = clean_momentzero_max
01589 canonical_results['clean_momentzero_rms'] = {}
01590 canonical_results['clean_momentzero_rms']['value'] = clean_momentzero_rms
01591
01592 canonical_results['clean_momentone_median'] = {}
01593 canonical_results['clean_momentone_median']['value'] = clean_momentone_median
01594
01595 canonical_results['clean_momentone_planezero'] = {}
01596 canonical_results['clean_momentone_planezero']['value'] = clean_momentone_planezero
01597 canonical_results['clean_momentone_planelast'] = {}
01598 canonical_results['clean_momentone_planelast']['value'] = clean_momentone_planelast
01599 canonical_results['clean_psfcenter'] = {}
01600 canonical_results['clean_psfcenter']['value'] = 1.0
01601
01602
01603 canonical_results['vis_mean_cal'] = {}
01604 canonical_results['vis_mean_cal']['value'] = vis_mean_cal
01605 canonical_results['vis_mean_src'] = {}
01606 canonical_results['vis_mean_src']['value'] = vis_mean_src
01607
01608
01609 canonical_results['model_sum'] = {}
01610 canonical_results['model_sum']['value'] = model_sum
01611 canonical_results['model_pbcor_sum'] = {}
01612 canonical_results['model_pbcor_sum']['value'] = model_pbcor_sum
01613
01614 canonical['results'] = canonical_results
01615
01616 print "Canonical Regression (default) from "+canonical['date']
01617
01618
01619
01620
01621 regression = {}
01622 regressfile = scriptprefix + '.pickle'
01623 prev_results = {}
01624
01625 try:
01626 fr = open(regressfile,'r')
01627 except:
01628 print "No previous regression results file "+regressfile
01629 regression['exist'] = False
01630 else:
01631 u = pickle.Unpickler(fr)
01632 regression = u.load()
01633 fr.close()
01634 print "Regression results filled from "+regressfile
01635 print "Regression from version "+regression['version']+" on "+regression['date']
01636 regression['exist'] = True
01637
01638 prev_results = regression['results']
01639
01640
01641
01642
01643
01644
01645 print '--Calculate Results--'
01646 print ''
01647
01648
01649
01650 try:
01651 srcmax = srcstat['max'][0]
01652 except:
01653 srcmax = 0.0
01654
01655 try:
01656 offrms = offstat['sigma'][0]
01657 except:
01658 offrms = 0.0
01659
01660 try:
01661 offlinerms = offlinestat['sigma'][0]
01662 except:
01663 offlinerms = 0.0
01664
01665 try:
01666 momzero_max = momzerostat['max'][0]
01667 except:
01668 momzero_max = 0.0
01669
01670 try:
01671 momzero_rms = momzerostat['rms'][0]
01672 except:
01673 momzero_rms = 0.0
01674
01675 try:
01676 momone_median = momonestat['median'][0]
01677 except:
01678 momone_median = 0.0
01679
01680
01681
01682
01683 try:
01684 momone_plane0 = momoneplane0['median'][0]
01685 except:
01686 momone_plane0 = vel0
01687
01688 try:
01689 momone_plane35 = momoneplane35['median'][0]
01690 except:
01691 momone_plane35 = vel35
01692
01693 try:
01694 psfcenter = psfstat['mean'][0]
01695 except:
01696 psfcenter = 0.0
01697
01698
01699
01700
01701 try:
01702 modflux = modstat['sum'][0]
01703 except:
01704 modflux = 0.0
01705
01706 try:
01707 pbcormodflux = pbcormodstat['sum'][0]
01708 except:
01709 pbcormodflux = 0.0
01710
01711
01712
01713
01714 new_regression = {}
01715
01716
01717 import datetime
01718 datestring=datetime.datetime.isoformat(datetime.datetime.today())
01719
01720
01721 myvers = casalog.version()
01722 try:
01723 myuser = os.getlogin()
01724 except:
01725 myuser = os.getenv('USER')
01726
01727 myuname = os.uname()
01728 myhost = myuname[1]
01729 myos = myuname[0]+' '+myuname[2]+' '+myuname[4]
01730 mycwd = os.getcwd()
01731 mypath = os.environ.get('CASAPATH')
01732
01733 mydataset = 'NGC4826 16apr98 BIMA'
01734
01735
01736 new_regression['date'] = datestring
01737 new_regression['version'] = myvers
01738 new_regression['user'] = myuser
01739 new_regression['host'] = myhost
01740 new_regression['cwd'] = mycwd
01741 new_regression['os'] = myos
01742 new_regression['uname'] = myuname
01743 new_regression['aipspath'] = mypath
01744
01745 new_regression['dataset'] = mydataset
01746
01747
01748
01749
01750
01751
01752 results = {}
01753
01754 op = 'divf'
01755 tol = 0.08
01756 results['clean_image_max'] = {}
01757 results['clean_image_max']['name'] = 'Clean image max'
01758 results['clean_image_max']['value'] = srcmax
01759 results['clean_image_max']['op'] = op
01760 results['clean_image_max']['tol'] = tol
01761
01762 results['clean_image_offsrc_max'] = {}
01763 results['clean_image_offsrc_max']['name'] = 'Clean image off-src rms'
01764 results['clean_image_offsrc_max']['value'] = offrms
01765 results['clean_image_offsrc_max']['op'] = op
01766 results['clean_image_offsrc_max']['tol'] = tol
01767
01768 results['clean_image_offline_max'] = {}
01769 results['clean_image_offline_max']['name'] = 'Clean image off-line rms'
01770 results['clean_image_offline_max']['value'] = offlinerms
01771 results['clean_image_offline_max']['op'] = op
01772 results['clean_image_offline_max']['tol'] = tol
01773
01774 results['clean_momentzero_max'] = {}
01775 results['clean_momentzero_max']['name'] = 'Moment 0 image max'
01776 results['clean_momentzero_max']['value'] = momzero_max
01777 results['clean_momentzero_max']['op'] = op
01778 results['clean_momentzero_max']['tol'] = tol
01779
01780 results['clean_momentzero_rms'] = {}
01781 results['clean_momentzero_rms']['name'] = 'Moment 0 image rms'
01782 results['clean_momentzero_rms']['value'] = momzero_rms
01783 results['clean_momentzero_rms']['op'] = op
01784 results['clean_momentzero_rms']['tol'] = tol
01785
01786 op = 'diff'
01787 tol = 0.1
01788 results['clean_momentone_median'] = {}
01789 results['clean_momentone_median']['name'] = 'Moment 1 image median'
01790 results['clean_momentone_median']['value'] = momone_median
01791 results['clean_momentone_median']['op'] = op
01792 results['clean_momentone_median']['tol'] = 3.0
01793
01794
01795
01796
01797 results['clean_momentone_planezero'] = {}
01798 results['clean_momentone_planezero']['name'] = 'Moment 1 plane 0'
01799 results['clean_momentone_planezero']['value'] = momone_plane0
01800 results['clean_momentone_planezero']['op'] = op
01801 results['clean_momentone_planezero']['tol'] = tol
01802
01803 results['clean_momentone_planelast'] = {}
01804 results['clean_momentone_planelast']['name'] = 'Moment 1 plane 35'
01805 results['clean_momentone_planelast']['value'] = momone_plane35
01806 results['clean_momentone_planelast']['op'] = op
01807 results['clean_momentone_planelast']['tol'] = tol
01808
01809 tol = 0.01
01810 results['clean_psfcenter'] = {}
01811 results['clean_psfcenter']['name'] = 'PSF CH27 at RefPix'
01812 results['clean_psfcenter']['value'] = psfcenter
01813 results['clean_psfcenter']['op'] = op
01814 results['clean_psfcenter']['tol'] = tol
01815
01816
01817 op = 'divf'
01818 tol = 0.08
01819 results['vis_mean_cal'] = {}
01820 results['vis_mean_cal']['name'] = 'Vis mean of cal'
01821 results['vis_mean_cal']['value'] = vismean_cal
01822 results['vis_mean_cal']['op'] = op
01823 results['vis_mean_cal']['tol'] = tol
01824
01825 results['vis_mean_src'] = {}
01826 results['vis_mean_src']['name'] = 'Vis mean of src'
01827 results['vis_mean_src']['value'] = vismean_src
01828 results['vis_mean_src']['op'] = op
01829 results['vis_mean_src']['tol'] = tol
01830
01831
01832
01833 results['model_sum'] = {}
01834 results['model_sum']['name'] = 'Model image sum'
01835 results['model_sum']['value'] = modflux
01836 results['model_sum']['op'] = op
01837 results['model_sum']['tol'] = tol
01838
01839 results['model_pbcor_sum'] = {}
01840 results['model_pbcor_sum']['name'] = 'PBcor Model image sum'
01841 results['model_pbcor_sum']['value'] = pbcormodflux
01842 results['model_pbcor_sum']['op'] = op
01843 results['model_pbcor_sum']['tol'] = tol
01844
01845
01846 resultlist = ['clean_image_max','clean_image_offsrc_max','clean_image_offline_max',
01847 'clean_momentzero_max','clean_momentzero_rms','clean_momentone_median',
01848 'clean_momentone_planezero','clean_momentone_planelast','clean_psfcenter',
01849 'vis_mean_cal','vis_mean_src','model_sum','model_pbcor_sum']
01850
01851 for keys in resultlist:
01852 res = results[keys]
01853 prev = None
01854 if prev_results.has_key(keys):
01855
01856 prev = prev_results[keys]
01857 results[keys]['test'] = 'Last'
01858 elif canonical_results.has_key(keys):
01859
01860 prev = canonical_results[keys]
01861 results[keys]['test'] = 'Canon'
01862 if prev:
01863 new_val = res['value']
01864 prev_val = prev['value']
01865 new_diff = new_val - prev_val
01866 if res['op'] == 'divf':
01867 new_diff /= prev_val
01868
01869 if abs(new_diff) > res['tol']:
01870 new_status = 'Failed'
01871 else:
01872 new_status = 'Passed'
01873
01874 results[keys]['prev'] = prev_val
01875 results[keys]['diff'] = new_diff
01876 results[keys]['status'] = new_status
01877 else:
01878
01879 results[keys]['prev'] = 0.0
01880 results[keys]['diff'] = 1.0
01881 results[keys]['status'] = 'Missed'
01882 results[keys]['test'] = 'none'
01883
01884
01885 new_regression['results'] = results
01886
01887
01888 datasize_raw = 96.0
01889 datasize_ms = 279.0
01890 new_regression['datasize'] = {}
01891 new_regression['datasize']['raw'] = datasize_raw
01892 new_regression['datasize']['ms'] = datasize_ms
01893
01894
01895
01896
01897 if benchmarking:
01898
01899 new_regression['timing'] = {}
01900
01901 total = {}
01902 total['wall'] = (endTime - startTime)
01903 total['cpu'] = (endProc - startProc)
01904 total['rate_raw'] = (datasize_raw/(endTime - startTime))
01905 total['rate_ms'] = (datasize_ms/(endTime - startTime))
01906
01907 new_regression['timing']['total'] = total
01908
01909 nstages = 15
01910 new_regression['timing']['nstages'] = nstages
01911
01912 stages = {}
01913 stages[0] = ['import',(import2time-startTime)]
01914 stages[1] = ['concat',(concat2time-import2time)]
01915 stages[2] = ['clearcal',(clearcal2time-concat2time)]
01916 stages[3] = ['listobs',(list2time-clearcal2time)]
01917 stages[4] = ['plotxy',(plotxy2time-list2time)]
01918 stages[5] = ['tflagdata',(flag2time-plotxy2time)]
01919 stages[6] = ['setjy',(setjy2time-flag2time)]
01920 stages[7] = ['gaincal',(gaincal2time-setjy2time)]
01921 stages[8] = ['fluxscale',(fluxscale2time-gaincal2time)]
01922 stages[9] = ['plotcal',(plotcal2time-fluxscale2time)]
01923 stages[10] = ['applycal',(correct2time-plotcal2time)]
01924 stages[11] = ['split',(split2time-correct2time)]
01925 stages[12] = ['clean',(clean2time-split2time)]
01926 stages[13] = ['math/stat',(math2time-clean2time)]
01927 stages[14] = ['moments',(moments2time-math2time)]
01928
01929 new_regression['timing']['stages'] = stages
01930
01931
01932
01933
01934
01935
01936 pickfile = 'out.'+prefix + '.regression.'+datestring+'.pickle'
01937 f = open(pickfile,'w')
01938 p = pickle.Pickler(f)
01939 p.dump(new_regression)
01940 f.close()
01941
01942 print ""
01943 print "Regression result dictionary saved in "+pickfile
01944 print ""
01945 print "Use Pickle to retrieve these"
01946 print ""
01947
01948
01949
01950
01951
01952
01953
01954
01955
01956
01957
01958
01959
01960
01961
01962
01963
01964 outfile='out.'+prefix+'.'+datestring+'.log'
01965 logfile=open(outfile,'w')
01966
01967
01968 print >>logfile,'Running '+myvers+' on host '+myhost
01969 print >>logfile,'at '+datestring
01970 print >>logfile,''
01971
01972
01973
01974
01975 print ' NGC4826 Image Cube Max = '+str(srcstat['max'][0])
01976 print " At ("+str(srcstat['maxpos'][0])+","+str(srcstat['maxpos'][1])+") Channel "+str(srcstat['maxpos'][3])
01977 print ' '+srcstat['maxposf']
01978 print ''
01979 print ' Off-Source Rms = '+str(offstat['sigma'][0])
01980 print ' Signal-to-Noise ratio = '+str(srcstat['max'][0]/offstat['sigma'][0])
01981 print ''
01982 print ' Off-Line Rms = '+str(offlinestat['sigma'][0])
01983 print ' Signal-to-Noise ratio = '+str(srcstat['max'][0]/offlinestat['sigma'][0])
01984 print ''
01985
01986 print >>logfile,' NGC4826 Image Cube Max = '+str(srcstat['max'][0])
01987 print >>logfile," At ("+str(srcstat['maxpos'][0])+","+str(srcstat['maxpos'][1])+") Channel "+str(srcstat['maxpos'][3])
01988 print >>logfile,' '+srcstat['maxposf']
01989 print >>logfile,''
01990 print >>logfile,' Off-Source Rms = '+str(offstat['sigma'][0])
01991 print >>logfile,' Signal-to-Noise ratio = '+str(srcstat['max'][0]/offstat['sigma'][0])
01992 print >>logfile,''
01993 print >>logfile,' Off-Line Rms = '+str(offlinestat['sigma'][0])
01994 print >>logfile,' Signal-to-Noise ratio = '+str(srcstat['max'][0]/offlinestat['sigma'][0])
01995 print >>logfile,''
01996
01997
01998 res = {}
01999 resultlist = ['clean_image_max','clean_image_offsrc_max','clean_image_offline_max',
02000 'clean_momentzero_max','clean_momentzero_rms','clean_momentone_median',
02001 'clean_momentone_planezero','clean_momentone_planelast','clean_psfcenter',
02002 'vis_mean_cal','vis_mean_src','model_sum','model_pbcor_sum']
02003
02004
02005 print >>logfile,'---'
02006 print >>logfile,'Regression versus previous values:'
02007 print >>logfile,'---'
02008 print '---'
02009 print 'Regression versus previous values:'
02010 print '---'
02011
02012 if regression['exist']:
02013 print >>logfile," Regression results filled from "+regressfile
02014 print >>logfile," Regression from version "+regression['version']+" on "+regression['date']
02015 print >>logfile," Regression platform "+regression['host']
02016
02017 print " Regression results filled from "+regressfile
02018 print " Regression from version "+regression['version']+" on "+regression['date']
02019 print " Regression platform "+regression['host']
02020 if regression.has_key('aipspath'):
02021 print >>logfile," Regression casapath "+regression['aipspath']
02022 print " Regression casapath "+regression['aipspath']
02023
02024 else:
02025 print >>logfile," No previous regression file"
02026
02027 print ""
02028 print >>logfile,""
02029
02030 final_status = 'Passed'
02031 for keys in resultlist:
02032 res = results[keys]
02033 print '--%30s : %12.6f was %12.6f %4s %12.6f (%6s) %s ' % ( res['name'], res['value'], res['prev'], res['op'], res['diff'], res['status'], res['test'] )
02034 print >>logfile,'--%30s : %12.6f was %12.6f %4s %12.6f (%6s) %s ' % ( res['name'], res['value'], res['prev'], res['op'], res['diff'], res['status'], res['test'] )
02035 if res['status']=='Failed':
02036 final_status = 'Failed'
02037
02038 if (final_status == 'Passed'):
02039 regstate=True
02040 print >>logfile,'---'
02041 print >>logfile,'Passed Regression test for NGC 4826 Mosaic'
02042 print >>logfile,'---'
02043 print 'Passed Regression test for NGC 4826 Mosaic'
02044 print ''
02045 print 'Regression PASSED'
02046 print ''
02047 else:
02048 regstate=False
02049 print >>logfile,'----FAILED Regression test for NGC 4826 Mosaic'
02050 print '----FAILED Regression test for NGC 4826 Mosaic'
02051 print ''
02052 print 'Regression FAILED'
02053 print ''
02054
02055
02056
02057
02058
02059 if benchmarking:
02060 print ''
02061 print 'Total wall clock time was: %10.3f ' % total['wall']
02062 print 'Total CPU time was: %10.3f ' % total['cpu']
02063 print 'Raw processing rate MB/s was: %8.1f ' % total['rate_raw']
02064 print 'MS processing rate MB/s was: %8.1f ' % total['rate_ms']
02065 print ''
02066 print '* Breakdown: *'
02067
02068 print >>logfile,''
02069 print >>logfile,'********* Benchmarking *************************'
02070 print >>logfile,'* *'
02071 print >>logfile,'Total wall clock time was: %10.3f ' % total['wall']
02072 print >>logfile,'Total CPU time was: %10.3f ' % total['cpu']
02073 print >>logfile,'Raw processing rate MB/s was: %8.1f ' % total['rate_raw']
02074 print >>logfile,'MS processing rate MB/s was: %8.1f ' % total['rate_ms']
02075 print >>logfile,'* Breakdown: *'
02076
02077 for i in range(nstages):
02078 print '* %16s * time was: %10.3f ' % tuple(stages[i])
02079 print >>logfile,'* %16s * time was: %10.3f ' % tuple(stages[i])
02080
02081 print >>logfile,'************************************************'
02082 print >>logfile,'sandrock (2008-06-17) wall time was: 377 seconds'
02083 print >>logfile,'sandrock (2008-06-17) CPU time was: 312 seconds'
02084
02085 logfile.close()
02086
02087 print "Done with NGC4826 Tutorial Regression"
02088
02089