Source
locclean( vis=msname, imagename=imname1, field='0,1', spw='', phasecenter=phasecenter, nterms=1, reffreq='1.5GHz', gridmode='advancedaprojection', wbawp=True, aterm=True, mterm=True, psterm=False, conjbeams=True, painc=360, rotpainc=360.0, cfcache=imname1+'.cfcache.dir', imsize=npix, cell='10.0arcsec', niter=10, gain=0.5, minpb=1e-04, usescratch=True)
################################################
#
# Regression/Benchmarking Script for wideband imaging with mosaicing #
#
################################################
#
# Data : Simulated wideband, two pointing mosaic, with PB rotation and squint.
# Sky : Single flat-spectrum point source
#
# (1) CS with wideband A-projection
# (2) MS-MFS with nterms=2 and wideband A-projection
#
#
################################################
import time
import os
# Data : reg_mawproject_apr13.ms in regression/wideband/
pathname=os.environ.get('CASAPATH').split()[0]
tempdir="./"
#tempdir="widebandmosaic_regression_data/"
#reuserepos=True
#if (reuserepos==False):
# os.system("rm -rf "+tempdir)
# os.mkdir(tempdir)
# pathname=os.environ.get('CASAPATH').split()[0] + "/data/regression/wideband/wbmos_awproject.ms"
# os.system("cp -r " + pathname + " " + tempdir)
# Initialize status flag
regstate = True;
# Start timers
startTime=time.time()
startProc=time.clock()
# Mark time
copyTime=time.time()
imname1=tempdir+'reg_widebandmosaic_cs.wbT.atT.mtT.psF'
imname2= tempdir+'reg_widebandmosaic_mtmfs.wbT.atT.mtT.psF'
msname = tempdir+'reg_mawproject_apr13.ms'
def locclean( vis='', imagename='', field='', spw='', phasecenter='', nterms=1, reffreq='1.5GHz', gridmode='advancedaprojection', wbawp=True, aterm=True, mterm=True, psterm=False, conjbeams=True, painc=360, rotpainc=360.0, cfcache='', imsize=512, cell='10.0arcsec', niter=10, gain=0.5, minpb=1e-04, usescratch=True ):
im.open(msname,usescratch=usescratch);
im.selectvis(spw=spw,field=field);
models=[];
restoreds=[];
residuals=[];
if(nterms>1):
for tt in range(0,nterms):
models.append(imagename+'.model.tt'+str(tt));
restoreds.append(imagename+'.image.tt'+str(tt));
residuals.append(imagename+'.residual.tt'+str(tt));
im.defineimage(nx=imsize,ny=imsize,
cellx=cell,celly=cell,
phasecenter = [phasecenter],
nchan=1,stokes='I',mode='mfs')
# start='1.0GHz',step='2.0GHz');
im.make(models[tt]);
algo = 'msmfs'
else:
models = [imagename+'.model'];
restoreds = [imagename+'.image'];
residuals = [imagename+'.residual'];
im.defineimage(nx=imsize,ny=imsize,
cellx=cell,celly=cell,
nchan=1,
phasecenter = [phasecenter],
stokes='IV',mode='mfs')
im.make(models[0]);
algo = 'hogbom'
im.weight(type='natural');
im.settaylorterms(ntaylorterms=nterms,
reffreq=(qa.convert(qa.unit(reffreq),"Hz"))['value']);
im.setscales(scalemethod='uservector',uservector=[0]);
if(gridmode=='advancedaprojection'):
im.setoptions(ftmachine='awproject',
applypointingoffsets=False,
dopbgriddingcorrections=True,
cfcachedirname=cfcache,
pastep=painc, rotpastep=rotpainc,pblimit=minpb,
psterm=psterm, aterm=aterm, wbawp=wbawp,mterm=mterm,conjbeams=conjbeams);
else:
im.setoptions(ftmachine="ft");
# im.setvp(dovp=True,usedefaultvp=True,telescope='EVLA');