Source
'''Concat 14: 2 parts of same MS split in time, use of ephemerides, first ephemeris covers both MS time ranges, not chronologically ordered'''
#############################################################################
# $Id:$
# Test Name: #
# Unit Test Script for the concat task
#
# #
#############################################################################
import os
import sys
import shutil
import glob
from __main__ import default
from tasks import *
from taskinit import *
import unittest
from math import sqrt
cb = cbtool( )
myname = 'test_concat'
# name of the resulting MS
msname = 'concatenated.ms'
testmms=False
def checktable(thename, theexpectation, multims=False):
global msname, myname
if multims:
tb.open(msname+"/SUBMSS/"+thename)
else:
tb.open(msname+"/"+thename)
if thename == "":
thename = "MAIN"
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()
except:
in_agreement = False
if not in_agreement:
print myname, ": Error in MS subtable", thename, ":"
print " column ", mycell[0], " row ", mycell[1], " contains ", value
print " expected value is ", mycell[2]
tb.close()
return False