Source
self.assertTrue(type(tb.getcol('CORRECTED_DATA')) == np.ndarray, msg='The CORRECTED_DATA column was not created properly')
##########################################################################
# test_task_clearcal.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://casadocs.readthedocs.io/en/stable/api/tt/casatasks.calibration.clearcal.html
#
# test_takesMS: Checks that clearcal only takes a valid MS
# test_modeldata: Checks that the MODEL_DATA column is generated with the proper values
# test_corrdata: Checks that the CORRECTED_DATA column is the same as the DATA columns
# test_fieldselect: Checks that the field parameter makes proper selections
# test_spwselect: Checks that the spw param makes the proper selections
# test_selectintent: Checks that the intent parameter make the proper selections
# test_addmodel: Check that a MODEL_DATA column is added if the parameter addmodel is True
# test_addcorr: Check that a CORRECTED_DATA columns is added if there was non before
#
##########################################################################
import os
import numpy as np
import unittest
# Try this instead of os.system
import shutil
import casatools
from casatasks import clearcal, casalog, rmtables
tb = casatools.table()
# DATA #
datapath = casatools.ctsys.resolve('unittest/clearcal/nep2-shrunk.ms')
filepath = casatools.ctsys.resolve('testlog.log')
# This is for test that check what the parameter validator does when parameters are
# given wrong types - these don't exercise the task but the parameter validator!
validator_exc_type = AssertionError
clearMS = 'nep2-shrunk.ms'
logpath = casalog.logfile()
class clearcal_test(unittest.TestCase):
def setUpClass(cls):
os.mkdir('fake.ms')
def setUp(self):
shutil.copytree(datapath, clearMS)
os.chmod(clearMS, 493)
for root, dirs, files in os.walk(clearMS):