Source
xxxxxxxxxx
refdict = {'1331+30500002_0': {}, '1445+09900002_0': {'Spw0': [1.0, 0.0085134637703004248, 0.025951269611231682, 0.0], 'SpwAve': [1.0, 0.0085134637703004248, 0.025951269611231682, 0.0]}, 'N5921_2': {}}
##########################################################################
# test_req_task_polfromgain.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.
#
# [Add the link to the JIRA ticket here once it exists]
#
# Based on the requirements listed in plone found here:
# https://casa.nrao.edu/casadocs/casa-5.4.0/global-task-list/task_polfromgain/about
#
#
##########################################################################
CASA6 = False
try:
import casatools
from casatasks import polfromgain
CASA6 = True
tb = casatools.table()
import sys
import os
sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
except ImportError:
from __main__ import default
from tasks import *
from taskinit import *
import os
import unittest
import shutil
import time
from casatestutils import generate_weblog
from casatestutils import stats_dict
from casatestutils import add_to_dict
from casatestutils import compare_caltables
from casatestutils import compare_dictionaries
import numpy
# DATA #
if CASA6:
datapath = casatools.ctsys.resolve('unittest/polfromgain/ngc5921.ms/')
caldata = casatools.ctsys.resolve('unittest/polfromgain/ngcgain.G0/')
refcal = casatools.ctsys.resolve('unittest/polfromgain/polfromgainCalCompare.cal')
else:
datapath = os.environ.get('CASAPATH').split()[0] + '/casatestdata/unittest/polfromgain/ngc5921.ms/'
caldata = os.environ.get('CASAPATH').split()[0] + '/casatestdata/unittest/polfromgain/ngcgain.G0/'
refcal = os.environ.get('CASAPATH').split()[0] + '/casatestdata/unittest/polfromgain/polfromgainCalCompare.cal'
datacopy = 'gaincopy.ms'
calpath = 'polfromgainout.cal'
refcopy = 'refcopy.cal'
test_dict = {}
class polfromgain_test(unittest.TestCase):
def setUp(self):
if not CASA6:
default(polfromgain)
shutil.copytree(datapath, datacopy)
shutil.copytree(refcal, refcopy)
def tearDown(self):
shutil.rmtree(datacopy)
if os.path.exists(refcopy):
shutil.rmtree(refcopy)
if os.path.exists(calpath):
shutil.rmtree(calpath)
def tearDownClass(cls):
generate_weblog("polfromgain", test_dict)
test_dict) (
def test_dictOutput(self):