Source
xxxxxxxxxx
msnames = {'RL_all':'Point/point_linRL.ms' , 'RL_par':'Point/point_parRL.ms' , 'RR_only':'Point/point_onlyRR.ms' ,'LL_only':'Point/point_onlyLL.ms' ,'XY_all':'Point/point_linXY.ms' ,'XY_par':'Point/point_parXY.ms' ,'XX_only':'Point/point_onlyXX.ms' ,'YY_only':'Point/point_onlyYY.ms' }
#######################################################
# #
# Regression/Test Script for Stokes-Selection in Imager and Clean #
# #
#######################################################
#
# (1) Given a 'true' [I,Q,U,V] vector,
# simulate MSs for [RR,RL,LR,LL], [RR,LL], [RR],[LL], [XX,XY,YX,YY], [XX,YY], [XX], [YY].
# (2) Test all possible options, some valid, some not : ['I','Q','U','V', 'IV', 'QU', 'IQ', 'UV',
# 'IQU', 'IUV', 'IQUV', 'RR', 'LL', 'RL','LR', 'RRLL','RLLR','XX','YY','XY','YX','XXYY','XYYX']
# (3) For runs that produce an output image, the resulting output (peak pixel value)
# is compared with the 'true' [I,Q,U,V,RR,LL,XX,YY].
# (4) Counts of 'pass' and 'fail' are, in the end, compared and used to detect regression.
# Note : This script tests both valid and invalid options.
#
#
######################################################
#
# More tests that will appear here in the future
# (See JIRA CAS 2587 : https://bugs.nrao.edu/browse/CAS-2587 ) :
#
# (1) Tests with partially flagged data
# (2) Tests with different minor-cycle algorithms
#
######################################################
import time
import os
# Init printing info.
import datetime
datestring=datetime.datetime.isoformat(datetime.datetime.today())
outfile='stokesimagingtest.'+datestring+'.log'
logfile=open(outfile,'w')
#####################################################
#### BEGIN : Helper function definition (tests are run after 'END') ####
#####################################################
################################
### Simulate a small MS
################################
def makeMS(choice='RL_all',stokesvals=[1.0,1.0,0.0,0.0],parentpath='.'):
dirname = parentpath+"/Point"
choicelist = ['RL_all','RL_par','RR_only','LL_only','XY_all','XY_par','XX_only','YY_only'];
if(not (choice in choicelist)):
print >>logfile, 'Cannot find specs for ', choice;
return;
if(choice=='RL_all'):
basename = dirname+"/point_linRL"
msstokes='RR RL LR LL';
feedtype='perfect R L';
if(choice=='XY_all'):
basename = dirname+"/point_linXY"
msstokes='XX XY YX YY';
feedtype='perfect X Y';
if(choice=='RL_par'):
basename = dirname+"/point_parRL"
msstokes='RR LL';
feedtype='perfect R L';
if(choice=='XY_par'):
basename = dirname+"/point_parXY"
msstokes='XX YY';
feedtype='perfect X Y';
if(choice=='XX_only'):
basename = dirname+"/point_onlyXX"
msstokes='XX';
feedtype='perfect X Y';
if(choice=='YY_only'):
basename = dirname+"/point_onlyYY"
msstokes='YY';
feedtype='perfect X Y';
if(choice=='RR_only'):
basename = dirname+"/point_onlyRR"
msstokes='RR';
feedtype='perfect R L';
if(choice=='LL_only'):
basename = dirname+"/point_onlyLL"
msstokes='LL';
feedtype='perfect R L';
msname = basename + '.ms';
clname = basename+'.cl';
if(not os.path.exists(dirname)):
cmd = 'mkdir ' + dirname;
os.system(cmd);
vx = [41.1100006, 134.110001, 268.309998, 439.410004, 644.210022]
vy = [3.51999998, -39.8300018, -102.480003, -182.149994, -277.589996]
vz = [0.25, -0.439999998, -1.46000004, -3.77999997, -5.9000001]