import matplotlib.pyplot as plt
from __main__ import default
datapath = os.environ.get('CASAPATH').split()[0] + "/casatestdata//unittest/plotms/"
testcaltables = {'a_mueller.uvcont.tbl': (250000, 'time', 'gamp'),
'anpos.autoCAS13057.cal': (40000, 'antenna1', 'antpos'),
'bandtypeBPOLY.B0': (70000, 'freq', 'gamp'),
'df_jones.cal': (120000, 'antenna1', 'gamp'),
'egaincurve.cal': (40000, 'time', 'gamp'),
'f_jones.cal': (50000, 'time', 'tec'),
'gaincaltest2.ms': (200000, 'time', 'amp'),
'gaincaltest2.ms.T0': (40000, 'time', 'gamp'),
'gaintypek.G0': (40000, 'antenna1', 'delay'),
'gaintypeSpline.G0': (90000, 'time', 'gamp'),
'g_evlaswpow.cal': (40000, 'time', 'spgain'),
'glinxphf_jones.cal': (30000, 'time', 'gamp'),
'k_jones.cal': (40000, 'antenna1', 'delay'),
'm_mueller.cal': (40000, 'time', 'gamp'),
'n08c1.sbdcal': (40000, 'time', 'delay'),
'ngc5921.ref1a.bcal': (100000, 'chan', 'gamp'),
'ngc5921.ref1a.gcal': (40000, 'time', 'gamp'),
'ngc5921.ref2a.gcal': (40000, 'time', 'gamp'),
'topac.cal': (30000, 'time', 'opac'),
'tsysweight_ave.tsys.cal': (100000, 'chan', 'tsys'),
'uid___A002_Xb0dfe8_Xcc8.orion_sio.skycal.tbl': (70000, 'time', 'greal'),
'xf_jones.cal': (80000, 'chan', 'gphase')}
if os.environ.has_key('TEST_DATADIR'):
DATADIR = str(os.environ.get('TEST_DATADIR'))+'/plotms/'
if os.path.isdir(DATADIR):
print('plotms tests will use data from '+ datapath)
class plotms_test_base(unittest.TestCase):
outputDir="/tmp/" + str(os.getpid()) + "/"
plotfile_jpg = "/tmp/myplot.jpg"
display = os.environ.get("DISPLAY")
testms3 = "sun.subset.pentagon.ms"
testms4 = "split_ddid_mixedpol_CAS-12283.ms"
testct = 'ngc5921.ref1a.gcal'
testct2 = 'ngc5921.ref2a.gcal'
testct3 = 'a_mueller.uvcont.tbl'
testct4 = 'ngc5921.ref1a.bcal'
testct5 = 'uid___A002_Xb0dfe8_Xcc8.orion_sio.skycal.tbl'
ms = os.path.join(outputDir, testms)
ms2 = os.path.join(outputDir, testms2)
ms3 = os.path.join(outputDir, testms3)
ms4 = os.path.join(outputDir, testms4)
ct = os.path.join(outputDir, testct)
ct2 = os.path.join(outputDir, testct2)
ct3 = os.path.join(outputDir, testct3)
ct4 = os.path.join(outputDir, testct4)
ct5 = os.path.join(outputDir, testct5)
if os.path.exists(self.outputDir):
shutil.rmtree(self.outputDir)
if not os.path.exists(self.ms):
shutil.copytree(os.path.join(datapath, self.testms),