from __future__ import absolute_import
from casatasks.private.casa_transition import is_CASA6
from casatools import ctsys, table
from casatasks import smoothcal
from __main__ import default
from casa_stack_manip import stack_frame_find
casa_stack_rethrow = stack_frame_find().get('__rethrow_casa_exceptions', False)
Unit tests for task smoothcal. It tests the following parameters:
vis: wrong and correct values
tablein: wrong and correct values
caltable: existence of output
field: wrong field value; non-default value
smmothtype: unsupported value; non-default value
smoothtime: unsupported value; non-default values
Other tests: check the values of column smoothed GAIN against reference.
class smoothcal_test(unittest.TestCase):
gcal = 'ngc1333_ut_nct.gcal'
ref = 'ngc1333_ut_nct.ref'
datapath = ctsys.resolve('unittest/smoothcal/')
datapath = os.path.join(os.environ.get('CASAPATH').split()[0],'casatestdata/unittest/smoothcal/')
shutil.copytree(os.path.join(datapath,self.msfile), self.msfile)
shutil.copytree(os.path.join(datapath,self.gcal), self.gcal)
shutil.copytree(os.path.join(datapath,self.ref), self.ref)
if (os.path.exists(self.msfile)):
os.system('rm -rf ' + self.msfile)
if (os.path.exists(self.gcal)):
os.system('rm -rf ' + self.gcal)
if (os.path.exists(self.ref)):
os.system('rm -rf ' + self.ref)
if (os.path.exists(self.out)):
os.system('rm -rf ' + self.out)
def getvarcol(self,table,colname):
'''Return the requested column'''
col = _tb.getvarcol(colname)
'''Test 0: Missing input table caught by parameter checking (exception thrown)
if is_CASA6 or casa_stack_rethrow:
"""Test 1: Wrong input MS caught by parameter checking (exception thrown)