Source
xxxxxxxxxx
appendantab(vis=data_copy, outvis=append_data, antab=evn_antab, overwrite=False, append_tsys=False, append_gc=True)
#########################################################################
# test_task_appendantab.py
# Copyright (C) 2018
# Associated Universities, Inc. Washington DC, USA.
#
# This script is free software; you can redistribute it and/or modify it
# under the terms of the GNU Library General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# This library is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
# License for more details.
#
#
# Based on the requirements listed in casadocs found here:
#
#
##########################################################################
import os
import shutil
import unittest
from unittest.mock import patch
import numpy as np
from casatestutils import testhelper as th
from casatasks import appendantab
from casatools import ctsys, table
tb = table()
datapath = ctsys.resolve('unittest/appendantab')
# input data
evn_data = "idi1.ms"
evn_antab = os.path.join(datapath, "n14c3.antab")
append_data = "appendedData.ms"
evn_ref = os.path.join(datapath, "appendantab_test.ms")
data_copy = "dataCopy.ms"
### This was for some local testing will remove when passing in bamboo ###
def compare_tsys(res):
compare_table = {}
result = True
# get all the cols from result
tb.open(res + "/SYSCAL")
res_cols = tb.colnames()
for col in res_cols:
if col not in compare_table:
compare_table[col] = tb.getcol(col)
tb.close()
# get all the cols from ref table
tb.open(evn_ref+ "/SYSCAL")
ref_cols = tb.colnames()
print("------------------------------------")
print(ref_cols)
for col in ref_cols:
if col not in compare_table:
result = False
print(col)
print(np.isclose(tb.getcol(col), compare_table[col], rtol=1e-6))
if col == "TSYS":
res = sorted(tb.getcol(col)[0])
orig = sorted(compare_table[col][0])
print("---------------------------")
#print(np.all(np.isclose(sorted(res[0]), sorted(orig[0]))))
for i, a in enumerate(res):
print('RES: ', a, ' || ORIG: ', orig[i])
#diff = np.all(np.isclose(tb.getcol(ref), compare_table[col]))
#if not diff:
# result = False
tb.close()
return False
class appendantab_test(unittest.TestCase):
def setUpClass(cls):
pass
def setUp(self):