casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables
plotxy_regression.py
Go to the documentation of this file.
00001 ##############################################################################
00002 #                                                                            #
00003 # Test Name:                                                                 #
00004 #    Plotxy Regression Script                                                #
00005 #                                                                            #
00006 # Usage: execfile('plotxy_regression.py')                                    #
00007 #    By default, the regression test runs with:                              #
00008 #        benchmarking=False (does not measure execution time)                #
00009 #        interactive=False (does not stop for user input)                    #
00010 #        currentaffair=False (does full regression)                          #
00011 #        setnewbase=True (save pngs as new base for future regression)       #
00012 #    Switch these parameters before execfile as needed.                      #
00013 #                                                                            #
00014 # This script is to run in a writeable directory (it writes png files).      # 
00015 # It creates a directory named 'plotxy_regression' and three subdirectories  # 
00016 # 'plot' , 'prev' and 'data'.  The 'plot' stores pngs from this regression.  #
00017 # The 'prev' stores pngs from previous regression. The 'data' store the      #
00018 # required test data.                                                        #
00019 #                                                                            #
00020 # The first time running this, it pulls data from known casa/data directory. # 
00021 # It then generates all pngs and save them into 'plot'                       #
00022 #                                                                            #
00023 # It is suggested to run subsequent regression from previously created       #
00024 # 'plotxy_regression' directory. Then (1) it pulls a dataset only if it is   #
00025 # not already in 'data' directory; (2) it generates new pngs and saves to    #
00026 # 'plot'; (3) it compares the corresponding pngs and writes the result;      #
00027 # (4) it saves generated pngs to 'prev' directory as a new baseline          # 
00028 #                                                                            #
00029 # It is often the case that you need to test only the current block issue.   #
00030 # You can do that by having the script in the 'test the current issue'       #
00031 # section and set currentaffair=True before run this script.                 #
00032 #                                                                            #
00033 # example: <CASA>cd <path_to_regression>/plotxy_regression                   #
00034 #          <CASA>interactive=False                                           #
00035 #          <CASA>execfile('<path_to_this_script>/plotxy_regression.py')      # 
00036 #                                                                            #
00037 # Output:                                                                    #
00038 #    plot files - plotxy_regression/plotxy.plot.name.png                     #
00039 #    all other results are written to casalogger                             #
00040 #                                                                            #
00041 # Features Tested:                                                           #
00042 # -1. pull test data sets from repository                                    #
00043 # 0. test the current issue                                                  #
00044 # 1. plotxy for possible xy axes                                             #
00045 # 2. plotxy non-average for possible xy axes                                 #
00046 # 3. plotxy for possible iterationss                                         #
00047 # 4. plotxy average detail calculationn                                      #
00048 # 5. plotxy for multi spectral windows                                       #
00049 # 6. plotxy for multi scan                                                   #
00050 # 7. plotxy for multi spw multi scan                                         #
00051 # 8. plotxy flagging                                                         #
00052 # 9. plotxy data selection                                                   #
00053 # 10. plotxy other issues                                                    #
00054 # 11. mp tool for average plotxys                                            #
00055 # 12. compare png files                                                      #
00056 # 13. save png files for future comparison                                   #
00057 #                                                                            #
00058 # Success/failure criteria:                                                  #
00059 # The stdout should show the number of points being plotted for each test    #
00060 # case. Any exception on stdout indicates a possible problem.                #
00061 #                                                                            #
00062 # Rationale for Inclusion:                                                   #
00063 #    This script is used to test plotxy functionalities                      #
00064 #                                                                            #
00065 ##############################################################################
00066 #                                                                            #
00067 # Created 2008-04-17                                                         #
00068 #                                                                            #
00069 ##############################################################################
00070 
00071 import os
00072 import time
00073 import getopt
00074 import shutil
00075 import sys
00076 import datetime
00077 import inspect
00078 import string
00079 import filecmp
00080 
00081 import regression_utility as tstutl
00082 
00083 pathname = ''
00084 try:
00085    pathname = casa['dirs']['data'] + '/regression/plotxy/'
00086 except:
00087    # Get path to CASA home directory by stipping name from '$CASAPATH'
00088    pathname=os.environ.get('CASAPATH').split()[0]
00089    pathname=pathname+'/data/regression/plotxy/'
00090 
00091 if not os.path.isdir(pathname):
00092    raise RuntimeError('could not find data path: ' + pathname)
00093 
00094 # The testdir where all output files will be kept
00095 testdir='plotxy_regression'
00096 testdata='data'
00097 testplot='plot'
00098 prevplot='prev'
00099 this="plotxy_regression"
00100 
00101 currentdir=os.curdir
00102 curpathlist=os.path.abspath(currentdir).split('/')
00103 startdir=curpathlist[len(curpathlist)-1]
00104 #print "currentdir:", currentdir
00105 #print "startdir:", startdir
00106 #print "testdir:", testdir
00107 
00108 
00109 #tstutl.stop("Test stop")
00110 #start the test from the dir name 'plotxy_regression' 
00111 if (startdir!=testdir):
00112    #create new testdir
00113    tstutl.maketestdir(testdir)
00114    os.chdir(testdir)
00115 
00116 #clear all previous plots
00117 tstutl.maketestdir(testplot)
00118 
00119 if (not os.path.exists(prevplot)):
00120    tstutl.maketestdir(prevplot)
00121 
00122 if (not os.path.exists(testdata)):
00123    #create new test data directory
00124    tstutl.maketestdir(testdata)
00125 
00126 # The prefix to use for all output files.
00127 prefix='plotxy.'
00128 
00129 # Check whether or not to record the total execution time
00130 global bench
00131 try:
00132    benchmarking
00133 except NameError:
00134    bench=False
00135 else:
00136    if benchmarking:
00137       bench=True
00138    else:
00139       bench=False
00140  
00141 # Check whether or not to wait for user input
00142 global manual
00143 try:
00144    interactive
00145 except NameError:
00146    manual=False
00147 else:
00148    if interactive:
00149       manual=True
00150    else:
00151       manual=False
00152 
00153 global current
00154 try:
00155    currentaffair
00156 except NameError:
00157    current=False
00158 else:
00159    if currentaffair:
00160       current=True
00161    else:
00162       current=False
00163 
00164 global savebase
00165 try:
00166    setnewbase
00167 except NameError:
00168    savebase=True
00169 else:
00170    if setnewbase:
00171       savebase=True
00172    else:
00173       savebase=False
00174 
00175 # Make up logfile name for this session
00176 #datestring=datetime.datetime.isoformat(datetime.datetime.today())
00177 #outfile=prefix+datestring+'.log'
00178 #logfile=open(outfile,'w')
00179 
00180 # Redirect stdout
00181 #saveout=sys.stdout
00182 #saveerr=sys.stderr
00183 #if (not manual):
00184 #   sys.stdout=logfile
00185 #   sys.stderr=logfile
00186 
00187    #Turn off logviewer - no, leave it on, system regression need it
00188    #for pid in logpid:
00189    #   #print 'pid: ',pid
00190    #   os.kill(pid,9)
00191 
00192    #Turn off debug log
00193    #casalog.filter('DEBUG2') 
00194 
00195 def plotfile(testName=""):
00196     return testplot+"/"+prefix+testName+'.png'
00197 
00198 #print out usage
00199 usage="plotxy_regression.py interactive=%s benchmarking=%s currentaffair=%s setnewbase=%s" % (manual, bench, current, savebase)
00200 tstutl.note(usage, "INFO", this)
00201 
00202 tstutl.note('*****************************************',"INFO",this)
00203 tstutl.note('******plotxy regression test start ******',"INFO",this)
00204 
00205 # Start bench clock
00206 if bench:
00207     startTime=time.time()
00208     startProc=time.clock()
00209 
00210 ##############################################################################
00211 # -1. preparing testing dataset                                              #
00212 ##############################################################################
00213 
00214 tstutl.note('########## Preparing test data... ##########',"INFO",this)
00215 msList=['NGC5921'
00216         ,'g19_12coall'
00217         ,'G24_92A_11' 
00218         ,'polcal_20041110_cband_vla_calaips'
00219         ,'3C84' 
00220         ,'whysong' 
00221         ,'coma' 
00222         ,'m87test' 
00223         ,'n4826_16apr98'
00224         #,'uid___X1eb_Xa30_X1'
00225         #,'uid___X1eb_X7888_X1'
00226         #,'uid___X1eb_Xa885_X1'
00227         ,'n2403'
00228         #,'3C273XC1'
00229         ,'testPhase_sdm' 
00230        ]
00231 
00232 taskname='importuvfits'
00233 default(taskname)
00234 
00235 hasTestData=True
00236 
00237 for k in range(len(msList)):
00238    # Set up the MS filename and save as new global variable
00239    dataName=msList[k]
00240    vis=testdata+'/'+dataName+'.ms'
00241    
00242    if (not os.path.exists(vis)):
00243       fitsfile=pathname+dataName+'.fits'
00244       msfile=pathname+dataName+'.ms'
00245       if (os.path.exists(msfile)):
00246          tstutl.note('copy msfile: '+msfile+'\n===========>'+vis,"INFO",this) 
00247          shutil.copytree(msfile, vis) 
00248       elif (os.path.exists(fitsfile)):
00249          tstutl.note('import fitsfile: '+fitsfile+'\n===============>'+vis,"INFO",this)
00250          importuvfits() 
00251       else:
00252          tstutl.note(vis+" does not exist.","INFO",this)
00253          tstutl.note("Could not find "+fitsfile+" at "+pathname,"WARN",this)
00254          tstutl.note("Could not find "+msfile+" at "+pathname,'WARN',this)
00255          hasTestData=False
00256    else:
00257       tstutl.note(vis+' found',"INFO",this) 
00258 
00259 tstutl.note('Done preparing test data',"INFO",this)
00260 
00261 # Record import time
00262 if bench:
00263    importtime=time.time()
00264    tstutl.note('Total data import time %.2f sec.' % (importtime - startTime),"INFO",this) 
00265 
00266 if not hasTestData:
00267    tstutl.stop('Required test data is not available. plotxy regression cannot continue')
00268    
00269 taskname='plotxy'
00270 
00271 ###############################################################################
00272 ## 0. test the current issue                                                  #
00273 ##   if the currentaffair=true, it stops after done this section of test      # 
00274 ##   the test in this section is temporary and changes as neccessary          #
00275 ###############################################################################
00276 tstutl.note('########## current issues ##########',"INFO",this)
00277 
00278 '''
00279 #test cas-822, crash on iteration
00280 default(taskname)
00281 dataset='3c129_6cm.ms'
00282 vis=testdata+'/'+dataset
00283 
00284 #plotxy(vis=msfile, selectdata=True, correlation='RR LL', xaxis='uvdist',
00285 #yaxis='amp', multicolor='both', iteration='antenna', field='0')
00286 yaxis="amp"
00287 xaxis="uvdist"
00288 selectdata=True
00289 correlation='RR LL'
00290 multicolor='both'
00291 iteration='antenna'
00292 antenna="0&1"
00293 field="1"
00294 timebin='0'
00295 width='1'
00296 overplot=False
00297 title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average)'
00298 figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin
00299 figfile=plotfile(figname)
00300 tstutl.note('plot '+title,"INFO",this)
00301 plotxy()
00302 
00303 '''
00304 
00305 '''
00306 #test unable to add a column
00307 default(taskname)
00308 dataset='uid___X1eb_X7888_X1.ms'
00309 vis=testdata+'/'+dataset
00310 
00311 xaxis="frequency"
00312 yaxis="amp"
00313 selectdata=True
00314 antenna="0&1"
00315 spw="0"
00316 field="1"
00317 timebin="10000000"
00318 crossscans=True
00319 plotsymbol="-"
00320 plotcolor="blue"
00321 connect="channel"
00322 overplot=False
00323 subplot=211
00324 datacolumn="data"
00325 title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average)'
00326 figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin
00327 figfile=plotfile(figname)
00328 tstutl.note('plot '+title,"INFO",this)
00329 plotxy()
00330 
00331 yaxis="phase"
00332 subplot=212
00333 plotxy()
00334 
00335 default(taskname)
00336 dataset='NGC5921.ms'
00337 vis=testdata+'/'+dataset
00338 timebin='90'
00339 width='8'
00340 showflags=False
00341 interactive=manual
00342 xaxis='azimuth'
00343 yaxis='amp'
00344 title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average)'
00345 figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin
00346 figfile=plotfile(figname)
00347 tstutl.note('plot '+title,"INFO",this)
00348 plotxy()
00349 '''
00350 
00351 #do not remove this if block
00352 if current:
00353    tstutl.stop("Done testing current issue")
00354 
00355 ##############################################################################
00356 # 1. plotxy averaged for all possible xy axes                                #
00357 ##############################################################################
00358 axisList=['time', 'channel', 'uvdist', 'azimuth', 'elevation',
00359             'baseline', 'hourangle', 'parallacticangle', 'u', 'v', 'w', 'x',
00360             'frequency', 'correlation', 'real','imag','amp','phase','weight'
00361             ,'velocity'
00362            ]
00363 
00364 default(taskname)
00365 dataset='NGC5921.ms'
00366 vis=testdata+'/'+dataset
00367 timebin='90'
00368 width='16'
00369 showflags=False
00370 interactive=manual
00371 
00372 tstutl.note('########## possible axes (averaged) ##########','INFO',this)
00373 
00374 for k in range(len(axisList)):
00375    xaxis=axisList[k]
00376    lyaxis=yaxis
00377    if (xaxis=='u'):
00378       lyaxis='v'
00379    if (xaxis=='x'):
00380       lyaxis='y'
00381    selectplot=True
00382    title=dataset+' '+lyaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average)'
00383    figname=dataset+'-'+lyaxis+'_'+xaxis+'_'+width+'_'+timebin
00384    figfile=plotfile(figname)
00385    tstutl.note('plot '+title,"INFO",this)
00386    plotxy()
00387 
00388 xaxis='real'
00389 yaxis='imag'
00390 selectplot=True
00391 title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ 'sec average)'
00392 figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin
00393 figfile=plotfile(figname)
00394 tstutl.note('plot '+title,"INFO",this)
00395 plotxy()
00396 
00397 # Record axis plot time
00398 if bench:
00399    importtime=time.time()
00400    tstutl.note('Total time for xais plot (averaged): %.2f sec.' % (importtime - startTime),'INFO',this) 
00401 
00402 ##############################################################################
00403 # 2. plotxy non-average for all possible xy axes                             #
00404 #    this takes a fairly long time                                           #
00405 ##############################################################################
00406 
00407 axisList=['time', 'channel', 'uvdist', 'azimuth', 'elevation',
00408             'baseline', 'hourangle', 'parallacticangle', 'u', 'v', 'w', 'x',
00409             'frequency', 'correlation', 'real','imag','amp','phase','weight'
00410             ,'velocity'
00411            ]
00412 
00413 default(taskname)
00414 dataset='NGC5921.ms'
00415 vis=testdata+'/'+dataset
00416 timebin='0'
00417 width='1'
00418 showflags=False
00419 interactive=manual
00420 
00421 tstutl.note('########## possible axes (non-averaged) ##########','INFO',this)
00422 
00423 for k in range(len(axisList)):
00424    xaxis=axisList[k]
00425    lyaxis=yaxis
00426    if (xaxis=='u'):
00427       lyaxis='v'
00428    if (xaxis=='x'):
00429       lyaxis='y'
00430    selectplot=True
00431    title=dataset+' '+lyaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average)'
00432    figname=dataset+'-'+lyaxis+'_'+xaxis+'_'+width+'_'+timebin
00433    figfile=plotfile(figname)
00434    plotxy()
00435    tstutl.note('plot '+title,"INFO",this)
00436 
00437 xaxis='real'
00438 yaxis='imag'
00439 selectplot=True
00440 title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ 'sec average)'
00441 figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin
00442 figfile=plotfile(figname)
00443 tstutl.note('plot '+title,"INFO",this)
00444 plotxy()
00445 
00446 # Record axis plot time
00447 if bench:
00448    importtime=time.time()
00449    tstutl.note('Total time for axis plot (non-average): %.2f sec.' % (importtime - startTime),'INFO',this) 
00450 
00451 
00452 ###################################################################################
00453 ###### 3. plotxy for possible iterationss                                         #
00454 ###################################################################################
00455 #####iterList = ['field', 'antenna', 'baseline', 'scan']#, 'feed'], 'corr']
00456 #####
00457 #####default(taskname)
00458 #####dataset='NGC5921.ms'
00459 #####vis=testdata+'/'+dataset
00460 #####averagemode='scalar'
00461 #####xaxis='time'
00462 #####yaxis='phase'
00463 #####timebin='90'
00464 #####width='16'
00465 #####showflags=False
00466 #####interactive=manual
00467 #####subplot=121
00468 #####
00469 #####tstutl.note('########## possible iterations (averaged) ##########','INFO',this)
00470 #####
00471 #####for k in range(len(iterList)):
00472 #####   iteration=iterList[k]
00473 #####   selectplot=True
00474 #####   title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ 'sec average)'
00475 #####   figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_iter_'+iteration
00476 #####   figfile=plotfile(figname)
00477 #####   tstutl.note('plot iteratrion: '+iteration+' '+title,'INFO',this) 
00478 #####   plotxy()
00479 #####   if (manual==True):
00480 #####      raw_input('mouse click on NEXT to iterate, press a key when done') 
00481 #####
00482 #####iteration=''
00483 #####subplot=111
00484 #####
00485 #####'''
00486 #####tstutl.note('########## possible iterations (non-averaged) ##########','INFO',this)
00487 ######if 3c129 is in repository, add this for non -averaged
00488 #####plotxy(vis='data/3c129_6cm.ms', selectdata=True, correlation='RR LL',
00489 #####xaxis='uvdist',yaxis='amp', multicolor='both', iteration='field')
00490 #####if (manual==True):
00491 #####   raw_input('mouse click on NEXT to iterate, press a key when done') 
00492 #####
00493 #####plotxy(vis='data/3c129_6cm.ms', selectdata=True, correlation='RR LL',
00494 #####xaxis='uvdist',yaxis='amp', multicolor='both', iteration='baseline')
00495 #####if (manual==True):
00496 #####   raw_input('mouse click on NEXT to iterate, press a key when done') 
00497 #####
00498 #####plotxy(vis='data/3c129_6cm.ms', selectdata=True, correlation='RR LL',
00499 #####xaxis='uvdist',yaxis='amp', multicolor='both', iteration='scan')
00500 #####if (manual==True):
00501 #####   raw_input('mouse click on NEXT to iterate, press a key when done') 
00502 #####
00503 #####plotxy(vis='data/3c129_6cm.ms', selectdata=True, correlation='RR LL',
00504 #####xaxis='uvdist',yaxis='amp', multicolor='both', iteration='feed')
00505 #####if (manual==True):
00506 #####   raw_input('mouse click on NEXT to iterate, press a key when done') 
00507 #####
00508 #####plotxy(vis='data/3c129_6cm.ms', selectdata=True, correlation='RR LL',
00509 #####xaxis='uvdist',yaxis='amp', multicolor='both', iteration='antenna', field='0')
00510 #####if (manual==True):
00511 #####   raw_input('mouse click on NEXT to iterate, press a key when done') 
00512 #####
00513 #####'''
00514 ###### Record axis plot time
00515 #####if bench:
00516 #####   importtime=time.time()
00517 #####   tstutl.note('Total time for iteration plot (averaged): %.2f sec.' % (importtime - startTime),'INFO',this) 
00518 #####
00519 #####
00520 ###################################################################################
00521 ###### 4. plotxy average detail calculationn                                      #
00522 ###################################################################################
00523 #####
00524 #####binList = ['0', '20', '30', '40', '50', '60', '70']
00525 #####colorList = ['green', 'blue', 'yellow', 'pink', 'black', 'black', 'black']
00526 #####symList = ['o', 'o', 'o', 'o', 'x', 'x', 'x']
00527 #####
00528 #####tstutl.note('########## average detail calculation ##########','INFO',this)
00529 #####
00530 #####default(taskname)
00531 #####dataset='3C84.ms'
00532 #####vis=testdata+'/'+dataset
00533 #####yaxis='phase'
00534 #####xaxis='time'
00535 #####interactive=manual
00536 #####
00537 ######select a small section of data
00538 #####selectdata=true
00539 #####field='0'
00540 #####correlation='RR'
00541 #####spw='0:5~6'
00542 #####scan=''
00543 #####feed=''
00544 #####array=''
00545 #####uvrange=''
00546 #####antenna='4&8'
00547 #####timerange='10:39:00~10:40:00'
00548 #####
00549 ######plot the data
00550 #####averagemode = 'vector'
00551 #####width = '1'
00552 #####timebin = '0'
00553 #####overplot = false
00554 #####plotsymbol = '.'
00555 #####plotcolor = 'red'
00556 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average)'
00557 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin
00558 #####figfile=plotfile(figname)
00559 #####tstutl.note('plot '+title,'INFO',this) 
00560 #####plotxy()
00561 #####
00562 ######channel average by 2, timeaverage 0-70
00563 #####width='2'
00564 #####
00565 #####for k in range(len(binList)):
00566 #####   timebin=binList[k]
00567 #####   overplot=true
00568 #####   plotsymbol=symList[k]
00569 #####   plotcolor=colorList[k]
00570 #####   title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average)'
00571 #####   figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin
00572 #####   figfile=plotfile(figname)
00573 #####   tstutl.note('plot '+title,'INFO',this) 
00574 #####   plotxy()
00575 #####
00576 ###################################################################################
00577 ###### 5. plotxy for multi spectral windows                                      #
00578 ###################################################################################
00579 #####
00580 #####tstutl.note('########## multi spectral windows ##########','INFO',this)
00581 #####
00582 #####default(taskname)
00583 #####dataset='testPhase_sdm.ms'
00584 #####vis=testdata+'/'+dataset
00585 #####field=''
00586 #####selectdata=true
00587 #####correlation=''
00588 #####antenna=''
00589 #####timerange=''
00590 #####yaxis='amp'
00591 #####xaxis='channel'
00592 #####averagemode='vector'
00593 #####overplot=false
00594 #####plotsymbol='.'
00595 ######plotcolor='green'
00596 #####interactive=manual
00597 #####
00598 ######plot the data
00599 #####averagemode = 'vector'
00600 #####width = '1'
00601 #####timebin = '0'
00602 #####overplot = false
00603 #####plotsymbol = '.'
00604 #####plotcolor = 'red'
00605 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+' sec average)'
00606 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_chan'
00607 #####figfile=plotfile(figname)
00608 #####tstutl.note('plot '+title,'INFO',this) 
00609 #####plotxy()
00610 #####
00611 #####width = '2'
00612 #####timebin = '60'
00613 #####spw = '0,1,2,3'
00614 #####xaxis='channel'
00615 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average) spw=0,1,2,3'
00616 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'chan_spw=0,1,2,3'
00617 #####figfile=plotfile(figname)
00618 #####tstutl.note('plot '+title,'INFO',this) 
00619 #####plotxy()
00620 #####
00621 #####spw = '4,5'
00622 #####xaxis='channel'
00623 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average) spw=4,5'
00624 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'chan_spw=4,5'
00625 #####figfile=plotfile(figname)
00626 #####tstutl.note('plot '+title,'INFO',this) 
00627 #####plotxy()
00628 #####
00629 #####spw = '6,7'
00630 #####xaxis='channel'
00631 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average) spw=6,7'
00632 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'chan_spw=6,7'
00633 #####figfile=plotfile(figname)
00634 #####tstutl.note('plot '+title,'INFO',this) 
00635 #####plotxy()
00636 #####
00637 #####spw = '0,1,2,3'
00638 #####xaxis='frequency'
00639 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average) spw=0,1,2,3'
00640 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'freq_spw=0,1,2,3'
00641 #####figfile=plotfile(figname)
00642 #####tstutl.note('plot '+title,'INFO',this) 
00643 #####plotxy()
00644 #####
00645 #####spw = '4,5'
00646 #####xaxis='frequency'
00647 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average) spw=4,5'
00648 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'freq_spw=4,5'
00649 #####figfile=plotfile(figname)
00650 #####tstutl.note('plot '+title,'INFO',this) 
00651 #####plotxy()
00652 #####
00653 #####spw = '6,7'
00654 #####xaxis='frequency'
00655 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+' sec average) spw=6,7'
00656 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'freq_spw=6,7'
00657 #####figfile=plotfile(figname)
00658 #####tstutl.note('plot '+title,'INFO',this) 
00659 #####plotxy()
00660 #####
00661 #####averagemode = 'vector'
00662 #####width='1'
00663 #####timebin='0'
00664 #####xaxis='channel'
00665 #####overplot=false
00666 #####plotsymbol='.'
00667 #####plotcolor='red'
00668 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+' sec average)'
00669 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_chan'
00670 #####figfile=plotfile(figname)
00671 #####tstutl.note('plot '+title,'INFO',this) 
00672 #####plotxy()
00673 #####
00674 #####spw = '0,1,2,3'
00675 #####xaxis='channel'
00676 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average) spw=0,1,2,3'
00677 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'chan_spw=0,1,2,3'
00678 #####figfile=plotfile(figname)
00679 #####tstutl.note('plot '+title,'INFO',this) 
00680 #####plotxy()
00681 #####
00682 #####spw = '4,5'
00683 #####xaxis='channel'
00684 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average) spw=4,5'
00685 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'chan_spw=4,5'
00686 #####figfile=plotfile(figname)
00687 #####tstutl.note('plot '+title,'INFO',this) 
00688 #####plotxy()
00689 #####
00690 #####spw = '6,7'
00691 #####xaxis='channel'
00692 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average) spw=6,7'
00693 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'chan_spw=6,7'
00694 #####figfile=plotfile(figname)
00695 #####tstutl.note('plot '+title,'INFO',this) 
00696 #####plotxy()
00697 #####
00698 ######tstutl.note('test of non-average freq conversion disabled','WARN',this) 
00699 #####spw = '0,1,2,3'
00700 #####xaxis='frequency'
00701 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average) spw=0,1,2,3'
00702 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'freq_spw=0,1,2,3'
00703 #####figfile=plotfile(figname)
00704 #####tstutl.note('plot '+title,'INFO',this) 
00705 #####plotxy()
00706 #####
00707 #####spw = '4,5'
00708 #####xaxis='frequency'
00709 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average) spw=4,5'
00710 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'freq_spw=4,5'
00711 #####figfile=plotfile(figname)
00712 #####tstutl.note('plot '+title,'INFO',this) 
00713 #####plotxy()
00714 #####
00715 #####spw = '6,7'
00716 #####xaxis='frequency'
00717 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average) spw=6,7'
00718 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'freq_spw=6,7'
00719 #####figfile=plotfile(figname)
00720 #####tstutl.note('plot '+title,'INFO',this) 
00721 #####plotxy()
00722 #####
00723 ###################################################################################
00724 ###### 6. plotxy multi scan                                                       #
00725 ###################################################################################
00726 #####
00727 #####tstutl.note('########## multi scan ##########','INFO',this)
00728 #####
00729 #####default(taskname)
00730 #####dataset='g19_12coall.ms'
00731 #####vis=testdata+'/'+dataset
00732 #####interactive=manual
00733 #####selectdata = true
00734 #####correlation = ''
00735 #####spw = ''
00736 #####antenna = ''
00737 #####timerange = ''
00738 #####yaxis = 'amp'
00739 #####averagemode = 'vector'
00740 #####width = '1'
00741 #####timebin = '0'
00742 #####subplot=111
00743 #####overplot = false
00744 #####plotsymbol = '.'
00745 #####plotcolor = 'green'
00746 #####
00747 #####field = '2'
00748 #####width='2'
00749 #####selectplot=true
00750 #####
00751 #####crossscans=false
00752 #####xaxis='time'
00753 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average) field=2'
00754 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'field=2'
00755 #####figfile=plotfile(figname)
00756 #####tstutl.note('plot '+title,'INFO',this) 
00757 #####plotxy()
00758 #####
00759 #####crossscans=false
00760 #####xaxis='time'
00761 #####timebin='600'
00762 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average) field=2'
00763 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'field=2'
00764 #####figfile=plotfile(figname)
00765 #####tstutl.note('plot '+title,'INFO',this) 
00766 #####plotxy()
00767 #####
00768 #####crossscans=true
00769 #####xaxis='time'
00770 #####timebin='600'
00771 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average) field=2,crossscans=1'
00772 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'field=2,crossscans=1'
00773 #####figfile=plotfile(figname)
00774 #####tstutl.note('plot '+title,'INFO',this) 
00775 #####plotxy()
00776 #####
00777 #####crossscans=false
00778 #####timebin='60000'
00779 #####xaxis='time'
00780 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average) field=2,crossscans=0'
00781 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'field=2,crossscans=0'
00782 #####figfile=plotfile(figname)
00783 #####tstutl.note('plot '+title,'INFO',this) 
00784 #####plotxy()
00785 #####
00786 #####crossscans=true
00787 #####timebin='60000'
00788 #####xaxis='time'
00789 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average) field=2,crossscans=1'
00790 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'field=2,crossscans=1'
00791 #####figfile=plotfile(figname)
00792 #####tstutl.note('plot '+title,'INFO',this) 
00793 #####plotxy()
00794 #####
00795 #####crossscans=true
00796 #####timebin='60000'
00797 #####antenna='2&3'
00798 #####xaxis='time'
00799 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average) field=2,crossscans=1,antenna=2&3'
00800 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'field=2,crossscans=1,antenna=2&3'
00801 #####figfile=plotfile(figname)
00802 #####tstutl.note('plot '+title,'INFO',this) 
00803 #####plotxy()
00804 #####
00805 ######test cross baselines
00806 #####default(taskname)
00807 #####dataset='NGC5921.ms'
00808 #####vis=testdata+'/'+dataset
00809 #####interactive=manual
00810 #####selectdata = true
00811 #####xaxis='time'
00812 #####yaxis='amp'
00813 #####datacolumn='data'
00814 #####iteration=''
00815 #####selectdata=True
00816 #####antenna=''
00817 #####timerange=''
00818 #####correlation='RR'
00819 #####scan=''
00820 #####feed=''
00821 #####array=''
00822 #####uvrange=''
00823 #####spw='0:50'
00824 #####field='2'
00825 #####crossscans=False
00826 #####averagemode='vector'
00827 #####width='4'
00828 #####
00829 #####timebin='600'
00830 #####crossbls=True
00831 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average) field=2,RR,crossbls=1'
00832 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'field=2,RR,crosssbls=1'
00833 #####figfile=plotfile(figname)
00834 #####tstutl.note('plot '+title,'INFO',this) 
00835 #####plotxy()
00836 #####
00837 #####crossbls=False
00838 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average) field=2,RR,corssbls=0'
00839 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'field=2,RR,crossscans=0'
00840 #####figfile=plotfile(figname)
00841 #####tstutl.note('plot '+title,'INFO',this) 
00842 #####plotxy()
00843 #####
00844 #####timebin='6000'
00845 #####crossbls=True
00846 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average) field=2,RR,crossbls=1'
00847 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'field=2,RR,crosssbls=1'
00848 #####figfile=plotfile(figname)
00849 #####tstutl.note('plot '+title,'INFO',this) 
00850 #####plotxy()
00851 #####
00852 #####crossbls=False
00853 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average) field=2,RR,corssbls=0'
00854 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'field=2,RR,crossscans=0'
00855 #####figfile=plotfile(figname)
00856 #####tstutl.note('plot '+title,'INFO',this) 
00857 #####plotxy()
00858 #####
00859 #####timebin='60000'
00860 #####crossbls=True
00861 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average) field=2,RR,crossbls=1'
00862 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'field=2,RR,crosssbls=1'
00863 #####figfile=plotfile(figname)
00864 #####tstutl.note('plot '+title,'INFO',this) 
00865 #####plotxy()
00866 #####
00867 #####crossbls=False
00868 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average) field=2,RR,crossbls=0'
00869 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'field=2,RR,crossblss=0'
00870 #####figfile=plotfile(figname)
00871 #####tstutl.note('plot '+title,'INFO',this) 
00872 #####plotxy()
00873 #####
00874 #####
00875 ###################################################################################
00876 ###### 8. plotxy multi spw multi scan                                             #
00877 ###################################################################################
00878 #####
00879 #####tstutl.note('########## multi spws multi scan ##########','INFO',this)
00880 #####
00881 #####default(taskname)
00882 #####dataset='n4826_16apr98.ms'
00883 #####vis=testdata+'/'+dataset
00884 #####selectdata = true
00885 #####correlation = ''
00886 #####spw = ''
00887 #####antenna = ''
00888 #####timerange = ''
00889 #####yaxis = 'amp'
00890 #####averagemode = 'vector'
00891 #####width = '1'
00892 #####timebin = '0'
00893 #####subplot=111
00894 #####overplot = false
00895 #####plotsymbol = '.'
00896 #####plotcolor = 'green'
00897 #####interactive=manual
00898 #####
00899 #####selectplot=true
00900 #####
00901 #####crossscans=false
00902 #####xaxis='time'
00903 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' '+timebin+ ' sec average) crossscans=0'
00904 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'crossscans=0'
00905 #####figfile=plotfile(figname)
00906 #####tstutl.note('plot '+title,'INFO',this) 
00907 #####plotxy()
00908 #####
00909 #####field = '2'
00910 #####spw='2'
00911 #####
00912 #####crossscans=false
00913 #####xaxis='time'
00914 #####width='2'
00915 #####timebin='6000'
00916 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' '+timebin+ ' sec average) field=2,spw=2,crossscans=0'
00917 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'field=2,spw=2,crossscans=0'
00918 #####figfile=plotfile(figname)
00919 #####tstutl.note('plot '+title,'INFO',this) 
00920 #####plotxy()
00921 #####
00922 #####crossscans=true
00923 #####xaxis='time'
00924 #####timebin='6000'
00925 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' '+timebin+ ' sec average) field=2,spw=2,crossscans=1'
00926 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'field=2,spw=2,crossscans=1'
00927 #####figfile=plotfile(figname)
00928 #####tstutl.note('plot '+title,'INFO',this) 
00929 #####plotxy()
00930 #####
00931 #####crossscans=false
00932 #####timebin='60000'
00933 #####xaxis='time'
00934 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' '+timebin+ ' sec average) field=2,spw=2,crossscans=0'
00935 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'field=2,spw=2,crossscans=0'
00936 #####figfile=plotfile(figname)
00937 #####tstutl.note('plot '+title,'INFO',this) 
00938 #####plotxy()
00939 #####
00940 #####crossscans=true
00941 #####timebin='60000'
00942 #####xaxis='time'
00943 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' '+timebin+ ' sec average) field=2,spw=2,crossscans=1'
00944 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'field=2,spw=2,crossscans=1'
00945 #####figfile=plotfile(figname)
00946 #####tstutl.note('plot '+title,'INFO',this) 
00947 #####plotxy()
00948 #####
00949 #####crossscans=true
00950 #####timebin='60000'
00951 #####antenna='2'
00952 #####width='4'
00953 #####xaxis='time'
00954 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' '+timebin+ ' sec average) field=2,spw=2,antenna=2,crossscans=1'
00955 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'field=2,spw=2,antenna=2,crossscans=1'
00956 #####figfile=plotfile(figname)
00957 #####tstutl.note('plot '+title,'INFO',this) 
00958 #####plotxy()
00959 #####
00960 #####crossscans=true
00961 #####field='4'
00962 #####width='16'
00963 #####antenna='2&3'
00964 #####xaxis='time'
00965 #####timebin='6000'
00966 #####connect='channel'
00967 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' '+timebin+ ' sec average) field=2,spw=2,antenna=2,3,crossscans=1'
00968 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'field=2,spw=2,antenna=2,antenna=2,3,crossscans=1'
00969 #####figfile=plotfile(figname)
00970 #####tstutl.note('plot '+title,'INFO',this) 
00971 #####plotxy()
00972 #####
00973 #####crossscans=false
00974 #####timebin='6000'
00975 #####xaxis='time'
00976 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' '+timebin+ ' sec average) field=2,spw=2,antenna=2,3,crossscans=1'
00977 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_'+'field=2,spw=2,antenna=2,antenna=2,3,crossscans=1'
00978 #####figfile=plotfile(figname)
00979 #####tstutl.note('plot '+title,'INFO',this) 
00980 #####plotxy()
00981 #####
00982 ###################################################################################
00983 ###### 9. plotxy data selection                                                   #
00984 ###################################################################################
00985 #####
00986 #####tstutl.note('########## data selection ##########','INFO',this)
00987 #####
00988 #####default(taskname)
00989 #####dataset='testPhase_sdm.ms'
00990 #####vis=testdata+'/'+dataset
00991 #####xaxis='channel'
00992 #####yaxis='amp'
00993 #####datacolumn='data'
00994 #####averagemode ='vector'
00995 #####timebin='100'
00996 #####crossscans=False
00997 #####interactive=manual
00998 #####
00999 #####width='4'
01000 #####field=''
01001 #####spw='4:3~51^2,5:7~15^9'
01002 #####selectdata=True
01003 #####antenna='1&2'
01004 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average)'
01005 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'carat'
01006 #####figfile=plotfile(figname)
01007 #####tstutl.note('plot '+title,'INFO',this) 
01008 #####plotxy()
01009 #####
01010 #####default(taskname)
01011 #####dataset='NGC5921.ms'
01012 #####vis=testdata+'/'+dataset
01013 #####interactive=manual
01014 #####xaxis='uvdist'
01015 #####yaxis='amp'
01016 #####datacolumn='data'
01017 #####averagemode='vector'
01018 #####timebin='100'
01019 #####width='4'
01020 #####selectdata=true
01021 #####uvrange='1~2klambda,3~4klambda'
01022 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average)'
01023 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_uvrange'
01024 #####figfile=plotfile(figname)
01025 #####tstutl.note('plot '+title,'INFO',this) 
01026 #####plotxy()
01027 #####
01028 #####timebin='0'
01029 #####width='1'
01030 #####selectdata=true
01031 #####uvrange='1~2klambda,3~4klambda'
01032 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average)'
01033 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_uvrange'
01034 #####figfile=plotfile(figname)
01035 #####tstutl.note('plot '+title,'INFO',this) 
01036 #####plotxy()
01037 #####
01038 ######test plotrange 
01039 #####default(taskname)
01040 #####dataset='NGC5921.ms'
01041 #####vis=testdata+'/'+dataset
01042 #####interactive=manual
01043 #####xaxis='time'
01044 #####yaxis='amp'
01045 #####datacolumn='data'
01046 #####averagemode='vector'
01047 #####timebin='0'
01048 #####width='1'
01049 #####plotrange=['09:50:24, 10:30:20', 0.02, 0.20]
01050 #####selectdata=false
01051 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average)'
01052 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_plotrangetime'
01053 #####figfile=plotfile(figname)
01054 #####tstutl.note('plot '+title,'INFO',this) 
01055 #####plotxy()
01056 #####
01057 #####plotrange=''
01058 #####selectdata=false
01059 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average)'
01060 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_plotrangedefault'
01061 #####figfile=plotfile(figname)
01062 #####tstutl.note('plot '+title,'INFO',this) 
01063 #####plotxy()
01064 #####
01065 #####'''
01066 ######test selection based on corr type
01067 #####default(taskname)
01068 #####dataset='uid___X1eb_Xa885_X1.ms'
01069 #####vis=testdata+'/'+dataset
01070 #####interactive=manual
01071 #####xaxis='channel'
01072 #####yaxis='amp'
01073 #####datacolumn='data'
01074 #####averagemode='vector'
01075 #####timebin='all'
01076 #####width='1'
01077 #####crossscans=true
01078 #####crossbls=false
01079 #####spw='0'
01080 #####selectdata=true
01081 #####antenna='*&&*'
01082 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average)'
01083 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_2antenna_all_corr'
01084 #####figfile=plotfile(figname)
01085 #####tstutl.note('plot '+title,'INFO',this) 
01086 #####plotxy()
01087 #####
01088 #####crossbls=true
01089 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average)'
01090 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_2antenna_all_corr_crossbls'
01091 #####figfile=plotfile(figname)
01092 #####tstutl.note('plot '+title,'INFO',this) 
01093 #####plotxy()
01094 #####
01095 #####crossbls=false
01096 #####antenna='*&*'
01097 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average)'
01098 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_2antenna_cross_corr'
01099 #####figfile=plotfile(figname)
01100 #####tstutl.note('plot '+title,'INFO',this) 
01101 #####plotxy()
01102 #####
01103 #####antenna='*&&&'
01104 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average)'
01105 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_2antenna_self_corr'
01106 #####figfile=plotfile(figname)
01107 #####tstutl.note('plot '+title,'INFO',this) 
01108 #####plotxy()
01109 #####
01110 #####crossbls=true
01111 #####title=dataset+' '+yaxis+' vs '+xaxis+' ('+width+' chan '+timebin+ ' sec average)'
01112 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_2antenna_self_corr_crossbls'
01113 #####figfile=plotfile(figname)
01114 #####tstutl.note('plot '+title,'INFO',this) 
01115 #####plotxy()
01116 #####'''
01117 #####
01118 ###################################################################################
01119 ###### 10. other issues                                                           #
01120 ###################################################################################
01121 #####
01122 #####tstutl.note('########## other issues ##########','INFO',this)
01123 #####
01124 #####default(taskname)
01125 #####dataset='polcal_20041110_cband_vla_calaips.ms'
01126 #####vis=testdata+'/'+dataset
01127 #####interactive=manual
01128 #####xaxis="uvdist"
01129 #####yaxis="phase"
01130 #####datacolumn="data"
01131 #####iteration=""
01132 #####selectdata=True
01133 #####antenna=""
01134 #####field="0137+331"
01135 #####uvrange=""
01136 #####timerange="02:37:19~02:37:22"
01137 #####correlation="RR"
01138 #####scan=""
01139 #####feed=""
01140 #####array=""
01141 #####averagemode="vector"
01142 #####width="1"
01143 #####timebin="0.001"
01144 #####crossscans=False
01145 #####plotsymbol="."
01146 #####plotcolor="blue"
01147 #####markersize=5.0
01148 #####linewidth=1.0
01149 #####connect="none"
01150 #####plotrange=[0,600,-180,180]
01151 #####multicolor="corr"
01152 #####selectplot=True
01153 #####overplot=False
01154 #####newplot=False
01155 #####clearpanel="Auto"
01156 #####skipnrows=1
01157 #####xlabels=""
01158 #####ylabels=""
01159 #####fontsize=10.0
01160 #####windowsize=1.0
01161 #####showflags=False
01162 #####interactive=manual
01163 #####
01164 #####
01165 #####spw=""
01166 #####subplot=121
01167 #####overplot=false
01168 #####title='spw=,averaged,uvdist'
01169 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_uvdist'
01170 #####figfile=plotfile(figname)
01171 #####tstutl.note('plot '+title,'INFO',this) 
01172 #####plotxy()
01173 #####
01174 #####spw="0,1"
01175 #####subplot=122
01176 #####overplot=false
01177 #####title='spw=0,1,averaged,uvdist'
01178 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_uvdist_spw01'
01179 #####figfile=plotfile(figname)
01180 #####tstutl.note('plot '+title,'INFO',this) 
01181 #####plotxy()
01182 #####
01183 #####spw='0'
01184 #####subplot=121
01185 #####overplot=false
01186 #####plotcolor='red'
01187 #####title='spw=0,averaged,uvdist'
01188 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_uvdist0'
01189 #####figfile=plotfile(figname)
01190 #####tstutl.note('plot '+title,'INFO',this) 
01191 #####plotxy()
01192 #####
01193 #####spw='1'
01194 #####subplot=122
01195 #####overplot=false
01196 #####title='spw=1,averaged,uvdist'
01197 #####plotcolor='blue'
01198 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_uvdist1'
01199 #####figfile=plotfile(figname)
01200 #####tstutl.note('plot '+title,'INFO',this) 
01201 #####plotxy()
01202 #####
01203 #####spw='1'
01204 #####subplot=121
01205 #####overplot=false
01206 #####title='spw=1,averaged,uvdist'
01207 #####plotcolor='blue'
01208 #####figfile=plotfile(figname)
01209 #####tstutl.note('plot '+title,'INFO',this) 
01210 #####plotxy()
01211 #####
01212 #####spw='0'
01213 #####subplot=121
01214 #####overplot=true
01215 #####plotcolor='red'
01216 #####title='spw=0-1,averaged,uvdist'
01217 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_uvdist0over1'
01218 #####figfile=plotfile(figname)
01219 #####tstutl.note('plot '+title,'INFO',this) 
01220 #####plotxy()
01221 #####
01222 #####spw='0'
01223 #####subplot=122
01224 #####overplot=false
01225 #####plotcolor='red'
01226 #####title='spw=0,averaged,uvdist'
01227 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_uvdist'
01228 #####figfile=plotfile(figname)
01229 #####tstutl.note('plot '+title,'INFO',this) 
01230 #####plotxy()
01231 #####
01232 #####spw='1'
01233 #####subplot=122
01234 #####overplot=true
01235 #####plotcolor='blue'
01236 #####title='spw=1-0,averaged,uvdist'
01237 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_uvdist1over0'
01238 #####figfile=plotfile(figname)
01239 #####tstutl.note('plot '+title,'INFO',this) 
01240 #####plotxy()
01241 #####
01242 #####timebin='0'
01243 #####width='1'
01244 #####spw='0,1'
01245 #####subplot=121
01246 #####overplot=false
01247 #####plotcolor='blue'
01248 #####title='spw=1,0,non-averaged,uvdist'
01249 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_uvdist'
01250 #####figfile=plotfile(figname)
01251 #####tstutl.note('plot '+title,'INFO',this) 
01252 #####plotxy()
01253 #####
01254 #####spw='0'
01255 #####subplot=122
01256 #####overplot=false
01257 #####plotcolor='blue'
01258 #####title='spw=1,0,non-averaged,uvdist'
01259 ######figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_uvdist'
01260 ######figfile=plotfile(figname)
01261 #####tstutl.note('plot '+title,'INFO',this) 
01262 #####plotxy()
01263 #####
01264 #####spw='1'
01265 #####subplot=122
01266 #####overplot=true
01267 #####plotcolor='red'
01268 #####title='spw=1,0,non-averaged,uvdist'
01269 #####figname=dataset+'-'+yaxis+'_'+xaxis+'_'+width+'_'+timebin+'_uvdist1over1'
01270 #####figfile=plotfile(figname)
01271 #####tstutl.note('plot '+title,'INFO',this) 
01272 #####plotxy()
01273 #####
01274 ###################################################################################
01275 ###### 11. use mp tool for average plotxys                                        #
01276 ###################################################################################
01277 #####dataset='NGC5921.ms'
01278 #####vis=testdata+'/'+dataset
01279 #####mp.open(vis)
01280 #####
01281 #####tstutl.note('########## use mp tool (averaged) ##########','INFO',this)
01282 #####
01283 #####plotList = ['vischannel', 'visfreq', 'vistime', 'uvdist', 
01284 #####            'uvcoverage', 'viscorr', 'visvelocity', 'hourangle', 
01285 #####            'azimuth', 'elevation', 'parallacticangle', 'weight'
01286 #####           ]
01287 #####width='4'
01288 #####timebin='90'
01289 #####averagemode='vector'
01290 #####avevel=false
01291 #####for k in range(len(plotList)):
01292 #####   plotname=plotList[k]
01293 #####   if (plotname=='visvelocity'):
01294 #####      avevel=true
01295 #####   mp.setdata()
01296 #####   mp.avedata(averagemode='vector', averagetime=timebin, averagechan=width, averagevel=avevel)
01297 #####   title=dataset+' '+plotname+' ('+width+' chan '+timebin+ ' sec average)'
01298 #####   figname=dataset+'_'+plotname+'_'+width+'_'+timebin+'.png'
01299 #####   figfile=plotfile(figname)
01300 #####   tstutl.note('plot '+title,'INFO',this) 
01301 #####   mp.plot(plotname)
01302 #####   mp.savefig(figfile)
01303 #####
01304 #####mp.closeMS()
01305 #####mp.close()
01306 #####
01307 ##############################################################################
01308 # 12. diff png files                                                         #
01309 ##############################################################################
01310 
01311 tstutl.note('########## diff png files ##########','INFO',this)
01312 
01313 prevlist=os.listdir(prevplot)
01314 thislist=os.listdir(testplot)
01315 oldplot=len(prevlist)
01316 newplot=len(thislist)
01317 tstutl.note("There are %s plots in prev directory (previous regression)" % oldplot,'INFO',this)
01318 tstutl.note("There are %s plots in plot directory (this regression)" % newplot,'INFO',this)
01319 
01320 if (newplot==0 or oldplot==0):
01321    tstutl.note("There is no png files to compare","INFO",this)
01322 else:
01323    
01324    cmplist=[]
01325    
01326    for k in range(len(prevlist)):
01327       pplot=prevlist[k]
01328       hasnew=False
01329       for j in range(len(thislist)):
01330          if (thislist[j]==pplot):
01331             hasnew=True
01332             break
01333       if (not hasnew):
01334          tstutl.note(pplot+' is not in %s directory' % testplot,'WARN',this)
01335       else:
01336          cmplist.append(pplot)
01337    
01338    for k in range(len(thislist)):
01339       pplot=thislist[k]
01340       hasold=False
01341       for j in range(len(prevlist)):
01342          if (prevlist[j]==pplot):
01343             hasold=True
01344             break
01345       if (not hasold):
01346          tstutl.note(pplot+' is not in %s directory' % prevplot,'WARN',this)
01347       else:
01348          already=False
01349          for j in range(len(cmplist)):
01350             if (cmplist[j]==pplot):
01351                already=True
01352                break;
01353          if (not already):
01354             cmplist.append(pplot)
01355    
01356    if (len(cmplist)==0):
01357       tstutl.note("There is no same png files to compare")
01358    else:
01359       tstutl.note("There are %s png files to compare" % len(cmplist))
01360    
01361    for k in range(len(cmplist)):
01362       pplot=testplot+'/'+cmplist[k]
01363       nplot=prevplot+'/'+cmplist[k]
01364       if (filecmp.cmp(nplot,pplot)):
01365          tstutl.note(cmplist[k]+' is same','INFO',this)
01366       else:
01367          tstutl.note(cmplist[k]+' differs ','WARN',this)
01368    
01369 ##############################################################################
01370 # 13. save png files                                                          #
01371 ##############################################################################
01372 
01373 #everything should be good if it reaches here
01374 if (savebase and os.path.exists(testplot)):
01375    if (os.path.exists(prevplot)):
01376       tstutl.cleanup(prevplot)
01377    shutil.copytree(testplot, prevplot) 
01378    tstutl.note("save plot files to prev as a new baseline",'INFO',this)
01379    
01380 ##############################################################################
01381 #done with all the test 
01382 if bench:
01383     endTime = time.time()
01384     endProc = time.clock()
01385     tstutl.note('Total wall clock time %.2f sec.' % (endTime - startTime),'INFO',this)
01386     tstutl.note('Total CPU        time %.2f sec.' % (endProc - startProc),'INFO',this)
01387 
01388 tstutl.note('******plotxy regression test finish******','INFO',this)
01389 tstutl.note('*****************************************','INFO',this)
01390 
01391 # Restore stdout and stderr
01392 #sys.stdout=saveout
01393 #sys.stderr=saveerr
01394 #logfile.close()
01395 
01396 print ''
01397 print 'Regression PASSED'
01398 print ''
01399 
01400 ##############################################################################
01401 '''
01402 import regression_utility as tstutl
01403 this='plotxy_regression'
01404 taskname='plotxy'
01405 testdata='data'
01406 testplot='plot'
01407 prefix='plotxy.'
01408 logfile=sys.stdout
01409 manual=True
01410 def plotfile(testName=""):
01411     return testplot+"/"+prefix+testName+'.png'
01412 '''
01413