Source
xxxxxxxxxx
self.res = testconcat(vis = ['shortpart1.ms', 'shortpart2.ms', 'shortpart3.ms', 'shortpart4.ms', 'shortpart5.ms'],
#############################################################################
# $Id:$
# Test Name: #
# Regression Test Script for the testconcat task
#
# #
#############################################################################
from __future__ import absolute_import
from __future__ import print_function
import os
import sys
import shutil
import glob
import unittest
from casatasks.private.casa_transition import is_CASA6
if is_CASA6:
from casatools import ctsys
from casatools import table as tbtool
from casatools import ms as mstool
from casatasks import split, testconcat
tb = tbtool( )
ms = mstool( )
datapath = ctsys.resolve('unittest/testconcat/')
else:
from __main__ import default
from tasks import *
from taskinit import *
dataroot = os.environ.get('CASAPATH').split()[0]
datapath = os.path.join(dataroot,'casatestdata/unittest/testconcat/')
myname = 'test_testconcat'
# name of the resulting MS
msname = 'testconcatenated.ms'
def checktable(thename, theexpectation):
global msname, myname
tb.open(msname+"/"+thename)
for mycell in theexpectation:
print(myname, ": comparing ", mycell)
value = tb.getcell(mycell[0], mycell[1])
# see if value is array
try:
isarray = value.__len__
except:
# it's not an array
# zero tolerance?
if mycell[3] == 0:
in_agreement = (value == mycell[2])
else:
in_agreement = ( abs(value - mycell[2]) < mycell[3])
else:
# it's an array
# zero tolerance?
if mycell[3] == 0:
in_agreement = (value == mycell[2]).all()
else:
try:
in_agreement = (abs(value - mycell[2]) < mycell[3]).all()