Source
xxxxxxxxxx
rerefant(vis=copyvis, tablein=copycal, caltable='out.cal', refant='VA01, VA02', refantmode='strict')
##########################################################################
# test_task_rerefant.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.rerefant.html
#
#
##########################################################################
import sys
import os
import unittest
import shutil
import numpy as np
import casatools
from casatasks import rerefant, casalog, fringefit, flagdata
tb = casatools.table()
#import pyfits
## DATA ##
casavis = casatools.ctsys.resolve('unittest/rerefant/ngc5921.ms/')
casacal = casatools.ctsys.resolve('unittest/rerefant/ngc5921.ref1a.gcal')
src = casatools.ctsys.resolve('unittest/rerefant/n08c1.ms')
copyvis = 'vis.ms'
copycal = 'copycal.gcal'
logpath = casalog.logfile()
def file_copy(filename, perm):
os.chmod(filename, perm)
for root, dirs, files in os.walk(filename):
for d in dirs:
os.chmod(os.path.join(root, d), perm)
for f in files:
os.chmod(os.path.join(root, f), perm)
class rerefant_test(unittest.TestCase):
def setUpClass(cls):
pass
def setUp(self):
shutil.copytree(casavis, copyvis)
shutil.copytree(casacal, copycal)
file_copy(copyvis, 493)
file_copy(copycal, 493)
def tearDown(self):
shutil.rmtree(copyvis)
shutil.rmtree(copycal)
casalog.setlogfile(logpath)
if os.path.exists('testlog.log'):
os.remove('testlog.log')
if os.path.exists('out.cal'):
shutil.rmtree('out.cal')
if os.path.exists('n08c1_reref.ms'):
shutil.rmtree('n08c1_reref.ms')
if os.path.exists("fringe.cal"):
shutil.rmtree("fringe.cal")
if os.path.exists("reref.cal"):
shutil.rmtree("reref.cal")
def tearDownClass(cls):
pass
def test_listPrioritizedFlex(self):
''' Test that the first item in refants is used with no drop out '''
rerefant(vis=copyvis, tablein=copycal, caltable='out.cal', refant='VA01', refantmode='flex')
tb.open('out.cal')