from __future__ import absolute_import
from __future__ import print_function
from casatasks.private.casa_transition import is_CASA6
from casatools import ctsys, table, quanta
from casatasks import fixvis, imstat, tclean, split
ctsys_resolve = ctsys.resolve
from __main__ import default
def ctsys_resolve(apath):
dataPath = os.path.join(os.environ['CASAPATH'].split()[0],'casatestdata/')
return os.path.join(dataPath,apath)
Unit tests for task fixvis.
1. Do converted directions in the FIELD table have the right shape?
2. Does the phase center shifting result in the expected shifts?
3. Does the distances parameter work
Note: The equinox_vis regression is a more general test of fixvis.
datapath = ctsys_resolve('unittest/fixvis/')
inpms2 = 'twocenteredpointsources.ms'
class fixvis_test1(unittest.TestCase):
if not os.path.exists(inpms):
shutil.copytree(os.path.join(datapath,inpms),inpms)
if not os.path.exists(inpms2):
shutil.copytree(os.path.join(datapath,inpms2),inpms2)
shutil.rmtree(outms, ignore_errors=True)
shutil.rmtree(outms2, ignore_errors=True)
shutil.rmtree(outms, ignore_errors=True)
shutil.rmtree(outms2, ignore_errors=True)
os.system('rm -rf test[yz]*')
def _fixvis_and_get_stats(self, phasecent, dist=""):
shutil.rmtree(outms2, ignore_errors=True)
fixvis(inpms2, outms2, field='0', refcode=refcode,
phasecenter=phasecent, distances=dist)
mystats = self._get_stats(0, 'testy')
self.fail("*** Unexpected error *** {}".format(exc))
def _get_stats(self, fld, imgname):
os.system('rm -rf ' + imgname + '*')
tclean( vis=outms2, imagename=imgname, field=str(fld), threshold='0.1mJy',
deconvolver='clark', gridder='standard', mask='user', imsize=[128,128],
cell=['0.10000008arcsec','0.10000008arcsec'], weighting='natural',
return imstat(imgname + '.image')
'''Test1: Do converted directions in the FIELD table have the right shape?'''
self.res = fixvis( inpms, outms, refcode=refcode )
_tb.open(outms + '/FIELD')